This commit is contained in:
2025-06-24 12:09:22 +02:00
parent 26e7467f7f
commit b867030c8d
6 changed files with 69 additions and 45 deletions

View File

@ -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,
};
});