Skip to content

Commit e0cd60b

Browse files
authored
Merge pull request #182 from w3bdesign/dev
Delete customer after order is placed
2 parents 61f81d6 + a4a714c commit e0cd60b

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

public/js/app.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16655,12 +16655,16 @@ var actions = {
1665516655
var commit = _ref4.commit;
1665616656
commit('UPDATE_CART', []);
1665716657
},
16658-
saveCustomerDetails: function saveCustomerDetails(_ref5, customer) {
16658+
deleteCustomer: function deleteCustomer(_ref5) {
1665916659
var commit = _ref5.commit;
16660-
commit('SAVE_CUSTOMER_DETAILS', customer);
16660+
commit('DELETE_CUSTOMER', []);
1666116661
},
16662-
setCheckoutFormToValid: function setCheckoutFormToValid(_ref6, value) {
16662+
saveCustomerDetails: function saveCustomerDetails(_ref6, customer) {
1666316663
var commit = _ref6.commit;
16664+
commit('SAVE_CUSTOMER_DETAILS', customer);
16665+
},
16666+
setCheckoutFormToValid: function setCheckoutFormToValid(_ref7, value) {
16667+
var commit = _ref7.commit;
1666416668
commit('SET_CHECKOUT_FORM_VALID', value);
1666516669
}
1666616670
};
@@ -16727,6 +16731,10 @@ var mutations = {
1672716731
var newState = state;
1672816732
newState.cart = cart;
1672916733
},
16734+
DELETE_CUSTOMER: function DELETE_CUSTOMER(state, customer) {
16735+
var newState = state;
16736+
newState.customer = customer;
16737+
},
1673016738
UPDATE_ORDER: function UPDATE_ORDER(state, order) {
1673116739
Object.assign(state.order, order);
1673216740
},
@@ -17029,6 +17037,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
1702917037

1703017038
if (response.statusText === 'Created') {
1703117039
store.dispatch('emptyCart');
17040+
store.dispatch('deleteCustomer');
1703217041
store.commit('UPDATE_ORDER', response.data);
1703317042
router.push('/success');
1703417043
}

resources/js/components/Checkout/OrderCheckout.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ export default defineComponent({
199199
localState.paymentIsProcessing = false;
200200
if (response.statusText === 'Created') {
201201
store.dispatch('emptyCart');
202+
store.dispatch('deleteCustomer');
202203
store.commit('UPDATE_ORDER', response.data);
203204
router.push('/success');
204205
}

resources/js/store/modules/actions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ const actions = {
1818
emptyCart({ commit }) {
1919
commit('UPDATE_CART', []);
2020
},
21+
deleteCustomer({ commit }) {
22+
commit('DELETE_CUSTOMER', []);
23+
},
2124
saveCustomerDetails({ commit }, customer) {
2225
commit('SAVE_CUSTOMER_DETAILS', customer);
2326
},

resources/js/store/modules/mutations.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ const mutations = {
77
const newState = state;
88
newState.cart = cart;
99
},
10+
DELETE_CUSTOMER(state, customer) {
11+
const newState = state;
12+
newState.customer = customer;
13+
},
1014
UPDATE_ORDER(state, order) {
1115
Object.assign(state.order, order);
1216
},

0 commit comments

Comments
 (0)