blob: 213187d2f3fb3b3c3943960596220de83a1bc76a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import { CategoryPromo, IPromotion } from '~/common/types/promotion';
export const getVariantById = async (variantId: number) => {
const url = `/api/product-variant/${variantId}`;
return await fetch(url).then((res) => res.json());
};
export const getVariantPromoByCategory = async (
variantId: number,
type: CategoryPromo
): Promise<{ data: IPromotion[] }> => {
const url = `/api/product-variant/${variantId}/promotion/${type}`;
return await fetch(url).then((res) => res.json());
};
|