crud coupon

This commit is contained in:
hamid zarghami
2025-09-27 16:44:02 +03:30
parent bf3662a436
commit 8b4ae93e9d
7 changed files with 346 additions and 5 deletions
+18
View File
@@ -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;
};