Skip to content

Commit

Permalink
Updated code(#2me4rbb)
Browse files Browse the repository at this point in the history
  • Loading branch information
disha1202 committed Jul 25, 2022
1 parent 7fc5d0c commit 4449d79
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/store/modules/shop/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ const actions: ActionTree<ShopState, RootState> = {
let resp;
try {
resp = await getStores(payload);
if(resp.status === 200 && !hasError(resp) && resp.data.response?.docs){
if(resp.status === 200 && !hasError(resp) && resp.data.response?.docs?.length > 0){
commit(types.SHOP_STORES_UPDATED, resp.data.response.docs);
return resp.data.response.docs;
} else {
return
return [];
}

} catch(err){
console.error(err);
return
return [];
}
},
async getShopifyConfigId({commit}, payload){
Expand All @@ -37,11 +37,11 @@ const actions: ActionTree<ShopState, RootState> = {
commit(types.SHOP_CONFIG_ID_UPDATED, shopifyConfigId);
return shopifyConfigId;
} else {
return
return "";
}
} catch(err) {
console.error(err);
return
return "";
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const actions: ActionTree<UserState, RootState> = {
'Content-Type': 'application/json'
}
})
if(stores){
if(stores.length){
const shop = this.state.shop.shop;
const shopifyConfigId = await store.dispatch('shop/getShopifyConfigId', {
data: {
Expand Down
11 changes: 4 additions & 7 deletions src/views/OrderDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,11 @@ export default defineComponent({
},
markPreorderBackorderItem (item: any, event: any) {
const product = this.getPreorderItemAvailability(item.sku)
if(product){
if(product.estimatedDeliveryDate){
item.properties.push({ name: 'Note', value: event.detail.value }, { name: 'PROMISE_DATE', value: DateTime.fromISO(product.estimatedDeliveryDate).toFormat("MM/dd/yyyy") })
} else {
item.properties.push({ name: 'Note', value: event.detail.value });
}
this.store.dispatch('order/updateLineItems', this.order);
item.properties.push({ name: 'Note', value: event.detail.value });
if(product.estimatedDeliveryDate){
item.properties.push({ name: 'PROMISE_DATE', value: DateTime.fromISO(product.estimatedDeliveryDate).toFormat("MM/dd/yyyy") })
}
this.store.dispatch('order/updateLineItems', this.order);
},
updateDraftOrder () {
this.store.dispatch('order/updateDraftOrder', this.order);
Expand Down

0 comments on commit 4449d79

Please sign in to comment.