Skip to content

Commit

Permalink
Merge pull request #96 from k2maan/#85zrhj216
Browse files Browse the repository at this point in the history
Fixed eCommerce options are not visible on settings page (#85zrhj216)
  • Loading branch information
adityasharma7 authored Jan 9, 2023
2 parents 7ef2e6a + 9487e87 commit 030de8a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ const actions: ActionTree<UserState, RootState> = {
*/
async getProfile ( { commit, dispatch }) {
const resp = await UserService.getProfile()
const userProfile = JSON.parse(JSON.stringify(resp.data));

if (resp.status === 200) {
const payload = {
"inputFields": {
Expand All @@ -95,6 +97,17 @@ const actions: ActionTree<UserState, RootState> = {
let stores = [] as any;
if(storeResp.status === 200 && !hasError(storeResp) && storeResp.data.docs?.length > 0) {
stores = [...storeResp.data.docs]

userProfile.stores = [
...stores,
{
// With the preorder app's use case, the user will get data specific to the product store
// or all the data, for instance, on the products page. either products belonging to the
// selected store are fetched or all the products are fetched.
productStoreId: "",
storeName: "All"
}
]
}

let userPrefStore = ''
Expand All @@ -108,7 +121,7 @@ const actions: ActionTree<UserState, RootState> = {
console.error(err)
}
dispatch('setEcomStore', { eComStore: userPrefStore ? userPrefStore : stores.length > 0 ? stores[0] : {} });
commit(types.USER_INFO_UPDATED, resp.data);
commit(types.USER_INFO_UPDATED, userProfile);
}
},

Expand Down

0 comments on commit 030de8a

Please sign in to comment.