temp
This commit is contained in:
9
src/apis/core/cart.api.ts
Normal file
9
src/apis/core/cart.api.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
|
||||||
|
export const CartApi = {
|
||||||
|
getCartByUserId: async (userId: string) => {
|
||||||
|
let result = await axios.get(`${import.meta.env.VITE_SV_HOST}/carts?userId=${userId}`)
|
||||||
|
return result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { CartApi } from "./core/cart.api";
|
||||||
import { CategoryApi } from "./core/category.api";
|
import { CategoryApi } from "./core/category.api";
|
||||||
import { CloudianryApi } from "./core/cloudinary.api";
|
import { CloudianryApi } from "./core/cloudinary.api";
|
||||||
import { ProductApi } from "./core/product.api";
|
import { ProductApi } from "./core/product.api";
|
||||||
@@ -7,5 +8,6 @@ export const Apis = {
|
|||||||
user: UserApi,
|
user: UserApi,
|
||||||
category: CategoryApi,
|
category: CategoryApi,
|
||||||
cloundInary: CloudianryApi,
|
cloundInary: CloudianryApi,
|
||||||
product: ProductApi
|
product: ProductApi,
|
||||||
|
cart: CartApi
|
||||||
}
|
}
|
||||||
6
src/types/cart.type.ts
Normal file
6
src/types/cart.type.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export interface CartItem {
|
||||||
|
id: string;
|
||||||
|
userId: string;
|
||||||
|
productId: string;
|
||||||
|
quantity: number
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user