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

Implemented: Empty state for invalid user(#187) #190

Merged
merged 4 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"Failed to upload image.": "Failed to upload image.",
"Favorites": "Favorites",
"Fetching time zones": "Fetching time zones",
"Fetching user details": "Fetching user details",
"Fields cannot be empty.": "Fields cannot be empty.",
"Filters": "Filters",
"Finish and create new user": "Finish and create new user",
Expand Down Expand Up @@ -214,6 +215,7 @@
"Users": "Users",
"user.name": "user.name",
"Username": "Username",
"User not found": "User not found",
"Verify password": "Verify password",
"View product store": "View product store",
"will be asked to reset their password when they login": "{name} will be asked to reset their password when they login",
Expand Down
5 changes: 0 additions & 5 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ const actions: ActionTree<UserState, RootState> = {
throw userResp.data
}
} catch (error) {
if (hasError(userResp)) {
showToast(translate('Something went wrong.'));
}
logger.error(error)
}

Expand Down Expand Up @@ -283,10 +280,8 @@ const actions: ActionTree<UserState, RootState> = {
selectedUser['createdByUserPartyId'] = resp.data.docs[0].partyId
}
}

commit(types.USER_SELECTED_USER_UPDATED, selectedUser)
},

updateSelectedUser({ commit }, selectedUser) {
commit(types.USER_SELECTED_USER_UPDATED, selectedUser)
},
Expand Down
12 changes: 11 additions & 1 deletion src/views/UserDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@
</ion-header>

<ion-content>
<main>
<div v-if="!isUserFetched" class="empty-state">
<ion-item lines="none">
<ion-spinner color="secondary" name="crescent" slot="start" />
{{ translate("Fetching user details") }}
</ion-item>
</div>
<div v-else-if="!Object.keys(selectedUser).length" class="empty-state">
<p>{{ translate("User not found") }}</p>
</div>
<main v-else>
<section class="user-details">
<ion-card v-if="isUserFetched || Object.keys(selectedUser).length" class="profile">
<div>
Expand Down Expand Up @@ -497,6 +506,7 @@ export default defineComponent({
shopifyShopsForProductStore: [] as any
}
},

async ionViewWillEnter() {
this.isUserFetched = false
await this.store.dispatch("user/getSelectedUserDetails", { partyId: this.partyId, isFetchRequired: true });
Expand Down
Loading