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
This commit is contained in:
Vitalii 2023-11-16 11:31:01 +02:00 committed by Storj Robot
parent 1ea81c8887
commit e474b9728c

View File

@ -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<boolean>(() => {
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.