File tree Expand file tree Collapse file tree 1 file changed +5
-27
lines changed Expand file tree Collapse file tree 1 file changed +5
-27
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ import { defineStore } from "pinia";
22
33const 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
You can’t perform that action at this time.
0 commit comments