Skip to content

Commit e079b21

Browse files
committed
Pinia cleanup
1 parent 8529bf0 commit e079b21

File tree

1 file changed

+5
-27
lines changed

1 file changed

+5
-27
lines changed

store/useCart.js

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { defineStore } from "pinia";
22

33
const state = {
44
cart: [],
5-
order: {},
6-
customer: {},
75
loading: true,
86
error: null,
97
};
@@ -28,37 +26,17 @@ export const useCart = defineStore("cartState", {
2826
},
2927

3028
clearCart() {
31-
this.cart.length = 0;
32-
},
33-
clearCustomer() {
34-
this.customer = {};
35-
},
36-
clearOrder() {
37-
this.order = {};
38-
},
39-
saveCustomerDetails(customer) {
40-
this.customer = customer;
41-
},
42-
saveOrderId(order) {
43-
this.order = order;
44-
},
45-
getSingleProduct(slug) {
46-
return this.products.find((product) => product.slug === slug);
29+
console.log("Called clear cart action");
30+
this.cart = [];
31+
//this.cart.length = 0;
32+
console.log("Length: ", this.cart.length);
4733
},
4834
},
4935
getters: {
5036
getCartQuantity() {
5137
return this.cart.reduce((total, product) => total + product.quantity, 0);
5238
},
53-
getOrderDetails() {
54-
return this.order;
55-
},
56-
getCartContent() {
57-
return this.cart;
58-
},
59-
getCustomerDetails() {
60-
return this.customer;
61-
},
39+
6240
getCartTotal() {
6341
const currencySymbol = useRuntimeConfig().public.currencySymbol || "kr";
6442

0 commit comments

Comments
 (0)