Here is the http-service -
public getProducts(
gender?: ProductGender,
category?: ProductCategory,
): Observable<IGetProductsResponse> {
const baseUrl = ENDPOINT;
return this.http.get<IGetProductsResponse>(
`${baseUrl}list?gender=${gender}&category=${category}`
);
}
If I'm sending the request like this, i get 0 as the value I'm not filling. for example -
http://localhost:4200/product-list?gender=1
I'll get the category value as 0.
How can i use the URL in a way that able to get only gender or category?.
Tried to change the URL to - ${baseUrl}list?gender=${gender} and that is working but it is not dynamic.