removed guest cart call
This commit is contained in:
parent
925836ff0c
commit
b1bc4dbba2
|
@ -16,7 +16,7 @@ import {
|
|||
doFetchGiftMessage,
|
||||
doPutCConectionCartItem
|
||||
} from '@/services/user_cart.service';
|
||||
import { getCookieByName, removeCookieByName } from '@/services/auth';
|
||||
// import { getCookieByName, removeCookieByName } from '@/services/auth';
|
||||
import { getField, updateField } from 'vuex-map-fields';
|
||||
import humps from 'lodash-humps';
|
||||
import { getAuthUser } from '@/services/auth';
|
||||
|
@ -186,66 +186,16 @@ export const userCartProduct = {
|
|||
})
|
||||
.catch(() => commit('cartTotalAmtProgress', false))
|
||||
},
|
||||
cartProductList: async({ commit, rootState, dispatch }) => {
|
||||
cartProductList: async({ commit, dispatch }) => {
|
||||
commit('setCartProductList', []);
|
||||
commit('cartProductsProgress', true);
|
||||
return doFetchQuote().then(async(quoteId) => {
|
||||
let guestQuoteId = getCookieByName("cr_guestQuoteId");
|
||||
if (guestQuoteId) {
|
||||
dispatch('cartProduct/cartProductList', guestQuoteId, { root: true }).then(async(response) => {
|
||||
console.log("response", response)
|
||||
let guestCartProduct = rootState.cartProduct.cartProductList;
|
||||
if (guestCartProduct.length > 0) {
|
||||
for (let i = 0; i < guestCartProduct.length; i++) {
|
||||
if (guestCartProduct[i].productType == 'configurable') {
|
||||
await dispatch("addToConfiguredCart", {
|
||||
sku: guestCartProduct[i].parentSku,
|
||||
qty: guestCartProduct[i].qty,
|
||||
typeId: guestCartProduct[i].productType,
|
||||
optionId: guestCartProduct[i].productOption.attributesInfo[0].optionId,
|
||||
optionValue: guestCartProduct[i].customAttributes.letter
|
||||
|
||||
})
|
||||
} else if (guestCartProduct[i].productType == 'giftcard') {
|
||||
await dispatch("addToGiftCart", {
|
||||
sku: guestCartProduct[i].sku,
|
||||
qty: guestCartProduct[i].qty,
|
||||
senderName: guestCartProduct[i].productOption.infoBuyRequest.giftcardSenderName,
|
||||
senderEmail: guestCartProduct[i].productOption.infoBuyRequest.giftcardSenderEmail,
|
||||
giftCartDetails: {
|
||||
recipientName: guestCartProduct[i].productOption.infoBuyRequest.giftcardRecipientName,
|
||||
recipientEmail: guestCartProduct[i].productOption.infoBuyRequest.giftcardRecipientEmail,
|
||||
senderMessage: guestCartProduct[i].productOption.infoBuyRequest.giftcardMessage,
|
||||
giftCardAmt: guestCartProduct[i].productOption.infoBuyRequest.giftcardAmount
|
||||
}
|
||||
})
|
||||
} else {
|
||||
await dispatch("addToCart", {
|
||||
sku: guestCartProduct[i].sku,
|
||||
qty: guestCartProduct[i].qty,
|
||||
ccid: guestCartProduct[i].ccid ? guestCartProduct[i].ccid : null,
|
||||
price: guestCartProduct[i].personalizeDetails ? guestCartProduct[i].qty * guestCartProduct[i].price : null,
|
||||
personalizeDetails: guestCartProduct[i].personalizeDetails ? guestCartProduct[i].personalizeDetails : null,
|
||||
builderId: guestCartProduct[i].builderId ? guestCartProduct[i].builderId : null,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
removeCookieByName("cr_guestQuoteId")
|
||||
const cartProductList = await doFetchCartProducts(quoteId);
|
||||
commit('setCartProductDetails', humps(cartProductList))
|
||||
commit('setCartProductList', humps(cartProductList))
|
||||
commit('cartProductsProgress', false);
|
||||
dispatch('productTotalAmt');
|
||||
})
|
||||
.catch(() => commit('cartProductsProgress', false))
|
||||
} else {
|
||||
let cartProductList = await doFetchCartProducts(quoteId);
|
||||
commit('setCartProductDetails', humps(cartProductList))
|
||||
commit('setCartProductList', humps(cartProductList))
|
||||
commit('cartProductsProgress', false);
|
||||
dispatch('productTotalAmt');
|
||||
}
|
||||
// }
|
||||
})
|
||||
.catch(() => commit('cartProductsProgress', false))
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue