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> => {
|
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 (
|
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> => {
|
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;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createProductVariant = async (variables: CreateProductVariantRequestType): Promise<CreateProductVariantResponseType> => {
|
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;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getProductById = async (id: string): Promise<GetProductByIdResponseType> => {
|
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;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateVariant = async (variables: UpdateVariantRequestType): Promise<UpdateVariantResponseType> => {
|
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;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getVariantById = async (productId: string, variantId: string): Promise<GetVariantByIdResponseType> => {
|
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;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user