17 lines
521 B
TypeScript
17 lines
521 B
TypeScript
import { AddToCartRequest, CartResponse } from '@interfaces/cart';
|
|
import { apiClient } from '@services';
|
|
|
|
export const addToCartApi = async (addToCartRequest: AddToCartRequest) => {
|
|
return apiClient.post<CartResponse>('/cart/items', addToCartRequest);
|
|
};
|
|
|
|
export const getCartApi = async () => {
|
|
return apiClient.get<CartResponse>('/cart');
|
|
};
|
|
|
|
export const updateCartItem = async (productId: string, quantity: number) => {
|
|
return apiClient.patch<CartResponse>(`/cart/items/${productId}`, {
|
|
quantity,
|
|
});
|
|
};
|