crud coupon
This commit is contained in:
@@ -3,6 +3,7 @@ import type {
|
||||
CreateCouponType,
|
||||
CouponType,
|
||||
CouponsResponse,
|
||||
GetCouponDetailResponseType,
|
||||
} from "../types/Types";
|
||||
|
||||
export const getCoupons = async (
|
||||
@@ -22,3 +23,20 @@ export const createCoupon = async (
|
||||
export const deleteCoupon = async (couponId: string): Promise<void> => {
|
||||
await axios.delete(`/admin/coupon/${couponId}`);
|
||||
};
|
||||
|
||||
export const getCouponDetail = async (
|
||||
couponId: string
|
||||
): Promise<GetCouponDetailResponseType> => {
|
||||
const { data } = await axios.get(`/admin/coupon/${couponId}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const updateCoupon = async (
|
||||
params: CreateCouponType
|
||||
): Promise<CouponType> => {
|
||||
const { data } = await axios.patch(
|
||||
`/admin/coupon/${params.couponId}`,
|
||||
params
|
||||
);
|
||||
return data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user