2020-06-30 11:43:29 +00:00
|
|
|
export default class ProductService {
|
2022-12-27 20:54:26 +00:00
|
|
|
constructor() {
|
|
|
|
const runtimeConfig = useRuntimeConfig();
|
2022-12-28 08:48:05 +00:00
|
|
|
|
2022-12-27 20:54:26 +00:00
|
|
|
this.contextPath = runtimeConfig.public.contextPath;
|
|
|
|
}
|
|
|
|
|
2020-06-30 11:43:29 +00:00
|
|
|
getProductsSmall() {
|
2022-12-27 20:54:26 +00:00
|
|
|
return fetch(this.contextPath + 'demo/data/products-small.json')
|
2022-09-14 14:26:41 +00:00
|
|
|
.then((res) => res.json())
|
|
|
|
.then((d) => d.data);
|
|
|
|
}
|
2020-06-30 11:43:29 +00:00
|
|
|
|
2022-09-14 14:26:41 +00:00
|
|
|
getProducts() {
|
2023-01-13 13:51:35 +00:00
|
|
|
return fetch(this.contextPath + 'demo/data/products.json')
|
2022-09-14 14:26:41 +00:00
|
|
|
.then((res) => res.json())
|
|
|
|
.then((d) => d.data);
|
2020-07-01 08:55:56 +00:00
|
|
|
}
|
2020-07-01 10:51:46 +00:00
|
|
|
|
2020-07-01 08:55:56 +00:00
|
|
|
getProductsWithOrdersSmall() {
|
2023-01-13 13:51:35 +00:00
|
|
|
return fetch(this.contextPath + 'demo/data/products-orders-small.json')
|
2022-09-14 14:26:41 +00:00
|
|
|
.then((res) => res.json())
|
|
|
|
.then((d) => d.data);
|
|
|
|
}
|
2020-06-30 11:43:29 +00:00
|
|
|
}
|