From 9875f3319e83123c638c78b83b12a28c7fc4abb9 Mon Sep 17 00:00:00 2001 From: gurusainath Date: Wed, 1 May 2024 19:23:28 +0530 Subject: [PATCH] chore: handled store loaders in the user --- web/lib/wrappers/authentication-wrapper.tsx | 10 +++++----- web/store/user/profile.store.ts | 2 +- web/store/user/user-setting.store.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/web/lib/wrappers/authentication-wrapper.tsx b/web/lib/wrappers/authentication-wrapper.tsx index f13e28e57..f643d09e9 100644 --- a/web/lib/wrappers/authentication-wrapper.tsx +++ b/web/lib/wrappers/authentication-wrapper.tsx @@ -72,6 +72,8 @@ export const AuthenticationWrapper: FC = observer((props if (isCurrentWorkspaceValid >= 0) redirectionRoute = `/${currentWorkspaceSlug}`; + console.log("redirectionRoute", redirectionRoute); + return redirectionRoute; }; @@ -113,11 +115,9 @@ export const AuthenticationWrapper: FC = observer((props if (pageType === EPageTypes.AUTHENTICATED) { if (currentUser?.id) { - if (currentUserProfile?.is_onboarded) { - return <>{children}; - } else { - const currentRedirectRoute = getWorkspaceRedirectionUrl(); - router.push(currentRedirectRoute); + if (currentUserProfile?.is_onboarded) return <>{children}; + else { + router.push(`/onboarding`); return; } } else { diff --git a/web/store/user/profile.store.ts b/web/store/user/profile.store.ts index fc4c66f6b..22ac80ebd 100644 --- a/web/store/user/profile.store.ts +++ b/web/store/user/profile.store.ts @@ -89,7 +89,7 @@ export class ProfileStore implements IProfileStore { return userProfile; } catch (error) { runInAction(() => { - this.isLoading = true; + this.isLoading = false; this.error = { status: "error", message: "Failed to fetch instance info", diff --git a/web/store/user/user-setting.store.ts b/web/store/user/user-setting.store.ts index 0ed17ea77..95b7242fe 100644 --- a/web/store/user/user-setting.store.ts +++ b/web/store/user/user-setting.store.ts @@ -65,7 +65,7 @@ export class UserSettingsStore implements IUserSettingsStore { } catch (error) { console.log("Failed to fetch profile details"); runInAction(() => { - this.isLoading = true; + this.isLoading = false; this.error = { status: "error", message: "Failed to fetch instance info",