From b64c406ae195226336cb2614b3ba872a3e976067 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Thu, 4 Apr 2024 11:07:11 +0530 Subject: [PATCH 1/4] Implemented: Empty state for invalid user(#187) --- src/locales/en.json | 2 ++ src/store/modules/user/actions.ts | 4 ---- src/views/UserDetails.vue | 21 ++++++++++++++++++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 08d538d..2de0d18 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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", @@ -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", diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 9958679..02177a1 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -230,9 +230,6 @@ const actions: ActionTree = { throw userResp.data } } catch (error) { - if (hasError(userResp)) { - showToast(translate('Something went wrong.')); - } logger.error(error) } @@ -283,7 +280,6 @@ const actions: ActionTree = { selectedUser['createdByUserPartyId'] = resp.data.docs[0].partyId } } - commit(types.USER_SELECTED_USER_UPDATED, selectedUser) }, diff --git a/src/views/UserDetails.vue b/src/views/UserDetails.vue index 842b125..2ac2c5c 100644 --- a/src/views/UserDetails.vue +++ b/src/views/UserDetails.vue @@ -8,7 +8,16 @@ -
+
+ + + {{ translate("Fetching user details") }} + +
+
+

{{ translate("User not found") }}

+
+
@@ -494,12 +503,18 @@ export default defineComponent({ imageUrl: "", isUserFetched: false, showPassword: false, - shopifyShopsForProductStore: [] as any + shopifyShopsForProductStore: [] as any, + isValid: false, + isLoading: false } }, + async ionViewWillEnter() { - this.isUserFetched = false + this.isUserFetched = false; + this.isLoading = true; await this.store.dispatch("user/getSelectedUserDetails", { partyId: this.partyId, isFetchRequired: true }); + this.isValid = Object.keys(this.selectedUser).length > 0; + this.isLoading = false; await this.fetchProfileImage() await Promise.all([this.store.dispatch('util/getSecurityGroups'), this.store.dispatch('util/fetchShopifyShopConfigs')]); From c9ed55b08269f7300baa5f97342ee9e2dcda4115 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Thu, 4 Apr 2024 15:29:49 +0530 Subject: [PATCH 2/4] Improved: start using isUserFetched to handle loading spinner(#187) --- src/views/UserDetails.vue | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/views/UserDetails.vue b/src/views/UserDetails.vue index 2ac2c5c..b3ad786 100644 --- a/src/views/UserDetails.vue +++ b/src/views/UserDetails.vue @@ -8,7 +8,7 @@ -
+
{{ translate("Fetching user details") }} @@ -504,17 +504,14 @@ export default defineComponent({ isUserFetched: false, showPassword: false, shopifyShopsForProductStore: [] as any, - isValid: false, - isLoading: false + isValid: false } }, async ionViewWillEnter() { this.isUserFetched = false; - this.isLoading = true; await this.store.dispatch("user/getSelectedUserDetails", { partyId: this.partyId, isFetchRequired: true }); this.isValid = Object.keys(this.selectedUser).length > 0; - this.isLoading = false; await this.fetchProfileImage() await Promise.all([this.store.dispatch('util/getSecurityGroups'), this.store.dispatch('util/fetchShopifyShopConfigs')]); From 71c8baf64b34304bfc8ff9c13c24bf33b0ad593e Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Thu, 4 Apr 2024 19:21:30 +0530 Subject: [PATCH 3/4] Updated: using selectedUser for condition check (#187) --- src/views/UserDetails.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/views/UserDetails.vue b/src/views/UserDetails.vue index b3ad786..aeb30f7 100644 --- a/src/views/UserDetails.vue +++ b/src/views/UserDetails.vue @@ -14,7 +14,7 @@ {{ translate("Fetching user details") }}
-
+

{{ translate("User not found") }}

@@ -504,14 +504,12 @@ export default defineComponent({ isUserFetched: false, showPassword: false, shopifyShopsForProductStore: [] as any, - isValid: false } }, async ionViewWillEnter() { this.isUserFetched = false; await this.store.dispatch("user/getSelectedUserDetails", { partyId: this.partyId, isFetchRequired: true }); - this.isValid = Object.keys(this.selectedUser).length > 0; await this.fetchProfileImage() await Promise.all([this.store.dispatch('util/getSecurityGroups'), this.store.dispatch('util/fetchShopifyShopConfigs')]); From 4ceee420da8658d9e42d8003514fda0a4cfc8b4d Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 5 Apr 2024 17:00:13 +0530 Subject: [PATCH 4/4] Updated: one check condition and umwanted commit change(#187) --- src/store/modules/user/actions.ts | 1 - src/views/UserDetails.vue | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 02177a1..45ebd24 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -282,7 +282,6 @@ const actions: ActionTree = { } commit(types.USER_SELECTED_USER_UPDATED, selectedUser) }, - updateSelectedUser({ commit }, selectedUser) { commit(types.USER_SELECTED_USER_UPDATED, selectedUser) }, diff --git a/src/views/UserDetails.vue b/src/views/UserDetails.vue index aeb30f7..d881d34 100644 --- a/src/views/UserDetails.vue +++ b/src/views/UserDetails.vue @@ -14,7 +14,7 @@ {{ translate("Fetching user details") }}
-
+

{{ translate("User not found") }}

@@ -503,12 +503,12 @@ export default defineComponent({ imageUrl: "", isUserFetched: false, showPassword: false, - shopifyShopsForProductStore: [] as any, + shopifyShopsForProductStore: [] as any } }, async ionViewWillEnter() { - this.isUserFetched = false; + this.isUserFetched = false await this.store.dispatch("user/getSelectedUserDetails", { partyId: this.partyId, isFetchRequired: true }); await this.fetchProfileImage() await Promise.all([this.store.dispatch('util/getSecurityGroups'), this.store.dispatch('util/fetchShopifyShopConfigs')]);