From e474b9728cad78ddae974aabb6c294d54f725e8c Mon Sep 17 00:00:00 2001 From: Vitalii Date: Thu, 16 Nov 2023 11:31:01 +0200 Subject: [PATCH] web/satellite: fix redundant redirect on first login Not partnered users were redirected to onboarding pricing plan step and back to all projects dashboard in case when they have not finished onboarding. That caused tons of redundant API requests to be done. Change-Id: I454a8cc29730943b84a351416b78c4281c47f6ca --- .../src/views/all-dashboard/AllDashboardArea.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/satellite/src/views/all-dashboard/AllDashboardArea.vue b/web/satellite/src/views/all-dashboard/AllDashboardArea.vue index a5d9bca8b..8d5b124a5 100644 --- a/web/satellite/src/views/all-dashboard/AllDashboardArea.vue +++ b/web/satellite/src/views/all-dashboard/AllDashboardArea.vue @@ -104,6 +104,16 @@ const showMFARecoveryCodeBar = computed((): boolean => { return user.isMFAEnabled && user.mfaRecoveryCodeCount < recoveryCodeWarningThreshold; }); +/** + * Indicates if user should be redirected to onboarding pricing plan step. + */ +const shouldShowPricingPlan = computed(() => { + return usersStore.shouldOnboard && + usersStore.state.user.partner !== '' && + configStore.state.config.pricingPackagesEnabled && + !appStore.state.hasShownPricingPlan; +}); + /** * Toggles MFA recovery modal visibility. */ @@ -171,7 +181,7 @@ onMounted(async () => { appStore.changeState(FetchState.LOADED); - if (usersStore.shouldOnboard && configStore.state.config.pricingPackagesEnabled && !appStore.state.hasShownPricingPlan) { + if (shouldShowPricingPlan.value) { appStore.setHasShownPricingPlan(true); // if the user is not legible for a pricing plan, they'll automatically be // navigated back to all projects dashboard.