File tree Expand file tree Collapse file tree
pages/products/components/product-list Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,11 +71,8 @@ export class ProductListComponent implements OnInit {
7171 getAllProducts ( ) {
7272 this . productService . getAllProducts ( this . page , this . perPage ) . subscribe ( {
7373 next : ( data ) => {
74- this . products = data . data ;
75-
76- this . first = data . first ;
77- this . rows = data . pages ;
78- this . totalRecords = data . items ;
74+ // this.products = data.data; // cpm db.json server
75+ this . products = data ;
7976 console . log ( "GET ALL PRODUCTS DATA" , data ) ;
8077 } ,
8178 error : ( err ) => {
Original file line number Diff line number Diff line change @@ -8,8 +8,7 @@ import { Category } from '../../models/Category.model';
88} )
99export class CategoriesService {
1010
11- // private url: string = environment.BASE_URL;
12- private url : string = 'http://localhost:3000' ;
11+ private url : string = environment . BASE_URL ;
1312 private uri : string = 'api/v1' ;
1413 private flag : string = 'categories'
1514
Original file line number Diff line number Diff line change @@ -9,8 +9,7 @@ import { Pagination } from '../../models/Pagination.model';
99} )
1010export class ProductsService {
1111
12- // private url: string = environment.BASE_URL;
13- private url : string = 'http://localhost:3000' ;
12+ private url : string = environment . BASE_URL ;
1413 private uri : string = 'api/v1' ;
1514 private flag : string = 'products'
1615
@@ -19,10 +18,14 @@ export class ProductsService {
1918 ) { }
2019
2120 getAllProducts ( page : number , perPage : number ) {
22- // return this.http.get<Product[]>(`${this.url}/${this.uri}/${this.flag}`);
23- return this . http . get < Pagination < Product > > ( `${ this . url } /${ this . flag } ?_page=${ page } &_per_page=${ perPage } ` ) ;
21+ return this . http . get < Product [ ] > ( `${ this . url } /${ this . flag } ?_page=${ page } &_per_page=${ perPage } ` ) ;
2422 }
2523
24+ // COM PAGINAÇÃO INTERFACE
25+ // getAllProducts(page: number, perPage: number) {
26+ // return this.http.get<Pagination<Product>>(`${this.url}/${this.flag}?_page=${page}&_per_page=${perPage}`);
27+ // }
28+
2629 getProductsById ( product_id : number ) {
2730 // return this.http.get<Product[]>(`${this.url}/${this.uri}/${this.flag}`);
2831 return this . http . get < Product > ( `${ this . url } /${ this . flag } /${ product_id } ` ) ;
Original file line number Diff line number Diff line change 11export const environment = {
2- BASE_URL : 'https://api.escuelajs.co'
2+ // BASE_URL: 'https://api.escuelajs.co',
3+ // BASE_URL: 'http://localhost:3000',
4+ BASE_URL : 'https://imports-kappa.vercel.app'
35} ;
Original file line number Diff line number Diff line change 11export const environment = {
2- BASE_URL : 'https://api.escuelajs.co'
2+ // BASE_URL: 'https://api.escuelajs.co',
3+ // BASE_URL: 'http://localhost:3000',
4+ BASE_URL : 'https://imports-kappa.vercel.app'
35} ;
You can’t perform that action at this time.
0 commit comments