fix: wrong api route
This commit is contained in:
@@ -21,7 +21,7 @@ export const createCoupon = async (
|
||||
};
|
||||
|
||||
export const deleteCoupon = async (couponId: string): Promise<void> => {
|
||||
await axios.delete(`/admin/coupon/${couponId}`);
|
||||
await axios.delete(`/admin/coupon/${couponId}/delete`);
|
||||
};
|
||||
|
||||
export const getCouponDetail = async (
|
||||
|
||||
@@ -56,27 +56,27 @@ export const getProducts = async (page: number = 1, limit: number = 10, search?:
|
||||
};
|
||||
|
||||
export const getProductVariants = async (productId: string): Promise<GetProductVariantsResponseType> => {
|
||||
const { data } = await axios.get(`/admin/products/variants/${productId}`);
|
||||
const { data } = await axios.get(`/admin/products/${productId}/variants`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const createProductVariant = async (variables: CreateProductVariantRequestType): Promise<CreateProductVariantResponseType> => {
|
||||
const { data } = await axios.post("/admin/products/variants/create", variables);
|
||||
const { data } = await axios.post(`/admin/products/${variables.productId}/variants`, variables);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getProductById = async (id: string): Promise<GetProductByIdResponseType> => {
|
||||
const { data } = await axios.get(`/admin/products/get/${id}`);
|
||||
const { data } = await axios.get(`/admin/products/${id}/details`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const updateVariant = async (variables: UpdateVariantRequestType): Promise<UpdateVariantResponseType> => {
|
||||
const { data } = await axios.patch(`/admin/products/variants/update`, variables);
|
||||
const { data } = await axios.patch(`/admin/products/${variables.productId}/variants`, variables);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getVariantById = async (productId: string, variantId: string): Promise<GetVariantByIdResponseType> => {
|
||||
const { data } = await axios.get(`/admin/products/variant/${productId}/${variantId}`);
|
||||
const { data } = await axios.get(`/admin/products/${productId}/variants/${variantId}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user