From 7ecab3874933bffcc8450bbabeb8bc103940c66c Mon Sep 17 00:00:00 2001 From: almirh <24458972+almirhodzic@users.noreply.github.com> Date: Sat, 24 Feb 2024 19:16:54 +0100 Subject: [PATCH] Show Products For Admin Also Low InStock --- src/app/secure/products/products.component.ts | 6 ++++-- src/app/services/productadmin.service.ts | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/app/services/productadmin.service.ts diff --git a/src/app/secure/products/products.component.ts b/src/app/secure/products/products.component.ts index 326db30..c14de5c 100644 --- a/src/app/secure/products/products.component.ts +++ b/src/app/secure/products/products.component.ts @@ -4,6 +4,7 @@ import { ProductService } from '../../services/product.service'; import { ToastrService } from 'ngx-toastr'; import { CategoryService } from '../../services/category.service'; import { CartService } from 'src/app/services/cart.service'; +import { ProductadminService } from 'src/app/services/productadmin.service'; @Component({ selector: 'app-products', @@ -25,7 +26,8 @@ export class ProductsComponent implements OnInit { private productService: ProductService, private toastr: ToastrService, private categoryService: CategoryService, - private cartService: CartService + private cartService: CartService, + private productAdminService: ProductadminService, ) { } ngOnInit(): void { @@ -33,7 +35,7 @@ export class ProductsComponent implements OnInit { } load(): void { - this.productService.all(this.page).subscribe( + this.productAdminService.all(this.page).subscribe( res => { this.products = res.data; this.lastPage = res.meta.last_page; diff --git a/src/app/services/productadmin.service.ts b/src/app/services/productadmin.service.ts new file mode 100644 index 0000000..8f1bd06 --- /dev/null +++ b/src/app/services/productadmin.service.ts @@ -0,0 +1,10 @@ +import { Injectable } from '@angular/core'; +import { RestService } from './rest.service'; +import { environment } from '../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class ProductadminService extends RestService { + endpoint = `${environment.api}/productadmin`; +}