Created
November 16, 2023 17:53
-
-
Save teomanofficial/6764a3cdca9e65a7eae9ba30739584a5 to your computer and use it in GitHub Desktop.
Angular NGXS - ProductsService
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from "@angular/core"; | |
import { HttpClient } from "@angular/common/http"; | |
import { GetProductsRequestModel } from "@store/products/models/get-products-request.model"; | |
import { GetProductsResponseModel } from "@store/products/models/get-products-response.model"; | |
@Injectable({ providedIn: 'root' }) | |
export class ProductsService { | |
constructor(private readonly http: HttpClient) { | |
} | |
getProducts({ skip, limit } : GetProductsRequestModel) { | |
const params = { skip: skip ?? 0, limit: limit ?? 10 }; | |
return this.http.get<GetProductsResponseModel>('products', { params }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment