summaryrefslogtreecommitdiff
path: root/src-migrate/services/productVariant.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src-migrate/services/productVariant.ts')
-rw-r--r--src-migrate/services/productVariant.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/src-migrate/services/productVariant.ts b/src-migrate/services/productVariant.ts
new file mode 100644
index 00000000..9fec4d1f
--- /dev/null
+++ b/src-migrate/services/productVariant.ts
@@ -0,0 +1,23 @@
+import odooApi from '~/libs/odooApi';
+import { IProductVariantSLA } from '~/types/productVariant';
+import { CategoryPromo, IPromotion } from '~/types/promotion';
+
+export const getVariantById = async (variantId: number) => {
+ const url = `/api/product-variant/${variantId}`;
+ return await fetch(url).then((res) => res.json());
+};
+
+export const getVariantPromoByCategory = async (
+ variantId: number,
+ type: CategoryPromo
+): Promise<{ data: IPromotion[] }> => {
+ const url = `/api/product-variant/${variantId}/promotion/${type}`;
+ return await fetch(url).then((res) => res.json());
+};
+
+export const getVariantSLA = async (
+ variantId: number
+): Promise<IProductVariantSLA> => {
+ const url = `/api/v1/product_variant/${variantId}/stock`;
+ return await odooApi('GET', url);
+};