pop-up
This commit is contained in:
@ -73,26 +73,26 @@ export const useProductStore = defineStore("productStore", () => {
|
||||
}
|
||||
|
||||
const cart = ref();
|
||||
async function getCart() {
|
||||
try {
|
||||
const res = await fetch(`http://127.0.0.1:4000/api/public/user/cart`, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
// async function getCart() {
|
||||
// try {
|
||||
// const res = await fetch(`http://127.0.0.1:4000/api/public/user/cart`, {
|
||||
// headers: {
|
||||
// "Content-Type": "application/json",
|
||||
// },
|
||||
// });
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`HTTP error: ${res.status}`);
|
||||
}
|
||||
// if (!res.ok) {
|
||||
// throw new Error(`HTTP error: ${res.status}`);
|
||||
// }
|
||||
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
// const data = await res.json();
|
||||
// console.log(data);
|
||||
|
||||
cart.value = data;
|
||||
} catch (error) {
|
||||
console.error("getList error:", error);
|
||||
}
|
||||
}
|
||||
// cart.value = data;
|
||||
// } catch (error) {
|
||||
// console.error("getList error:", error);
|
||||
// }
|
||||
// }
|
||||
|
||||
return {
|
||||
productList,
|
||||
@ -100,6 +100,6 @@ export const useProductStore = defineStore("productStore", () => {
|
||||
getList,
|
||||
getModules,
|
||||
addToCart,
|
||||
getCart,
|
||||
// getCart,
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user