Update frontend for image loading
This commit is contained in:
@@ -11,5 +11,5 @@ export class Product {
|
|||||||
export class ProductImage {
|
export class ProductImage {
|
||||||
imageID: number = 0;
|
imageID: number = 0;
|
||||||
productID: number = 0;
|
productID: number = 0;
|
||||||
image: File | null = null;
|
image: Blob | null = null;
|
||||||
}
|
}
|
||||||
@@ -20,9 +20,20 @@ export class CatalogComponent {
|
|||||||
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
|
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
|
||||||
this.title.setTitle("Store | Mistox");
|
this.title.setTitle("Store | Mistox");
|
||||||
|
|
||||||
|
// load each product
|
||||||
http.post<Product[]>("https://mistox.com/api/product/getall", null).subscribe(
|
http.post<Product[]>("https://mistox.com/api/product/getall", null).subscribe(
|
||||||
response => {
|
response => {
|
||||||
this.Products = response;
|
this.Products = response;
|
||||||
|
|
||||||
|
// Load each image
|
||||||
|
this.Products.forEach(item => {
|
||||||
|
item.images.forEach(img => {
|
||||||
|
http.get("https://mistox.com/api/productimage/get?ProductID=" + img.productID + "&ImageID=" + img.imageID, { responseType: 'blob' }).subscribe(blob => {
|
||||||
|
img.image = blob;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user