list coupons

This commit is contained in:
hamid zarghami
2025-09-27 11:59:15 +03:30
parent 0fa7fbf99b
commit bf3662a436
7 changed files with 196 additions and 11 deletions
+12 -2
View File
@@ -1,7 +1,13 @@
import axios from "../../../config/axios";
import type { CreateCouponType, CouponType } from "../types/Types";
import type {
CreateCouponType,
CouponType,
CouponsResponse,
} from "../types/Types";
export const getCoupons = async (page: number = 1) => {
export const getCoupons = async (
page: number = 1
): Promise<CouponsResponse> => {
const { data } = await axios.get(`/admin/coupon/native?page=${page}`);
return data;
};
@@ -12,3 +18,7 @@ export const createCoupon = async (
const { data } = await axios.post("/admin/coupon", couponData);
return data;
};
export const deleteCoupon = async (couponId: string): Promise<void> => {
await axios.delete(`/admin/coupon/${couponId}`);
};