Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated: code to fetch shopifyConfigId corresponding to product store(#2kbnqzb) #199

Merged
merged 8 commits into from
Jul 19, 2022
13 changes: 10 additions & 3 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const actions: ActionTree<UserState, RootState> = {
if (resp.data.token) {
commit(types.USER_TOKEN_CHANGED, { newToken: resp.data.token })
await dispatch('getProfile')
dispatch('getShopifyConfig')
return resp.data;
} else if (hasError(resp)) {
showToast(translate('Sorry, your username or password is incorrect. Please try again.'));
Expand Down Expand Up @@ -73,6 +72,9 @@ const actions: ActionTree<UserState, RootState> = {
}
]
})
if(resp.data?.stores[0]){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assign it to a variable and then use

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the requested change.

dispatch('getShopifyConfig', resp.data?.stores[0].productStoreId);
}

this.dispatch('util/getServiceStatusDesc')
if (resp.data.userTimeZone) {
Expand All @@ -89,6 +91,7 @@ const actions: ActionTree<UserState, RootState> = {
async setEcomStore({ commit, dispatch }, payload) {
dispatch('job/clearJobState', null, { root: true });
commit(types.USER_CURRENT_ECOM_STORE_UPDATED, payload.eComStore);
dispatch('getShopifyConfig', payload.eComStore.productStoreId);
},
/**
* Update user timeZone
Expand All @@ -111,10 +114,14 @@ const actions: ActionTree<UserState, RootState> = {
commit(types.USER_INSTANCE_URL_UPDATED, payload)
},

async getShopifyConfig({ commit }) {
async getShopifyConfig({ commit }, productStoreId) {
const resp = await UserService.getShopifyConfig({
"inputFields": {
"productStoreId": productStoreId,
},
"entityName": "ShopifyConfig",
"noConditionFind": "Y"
"noConditionFind": "Y",
"fieldList": ["shopifyConfigId"]
})

if (resp.status === 200 && !hasError(resp)) {
Expand Down