Update onboarding status
This commit is contained in:
@@ -101,7 +101,7 @@ export const PageChangeEffect = () => {
|
||||
onboardingStatus === OnboardingStatus.Completed &&
|
||||
isMatchingOnboardingRoute
|
||||
) {
|
||||
navigate('/');
|
||||
navigate(AppPath.Index);
|
||||
} else if (isMatchingLocation(AppPath.Invite)) {
|
||||
const inviteHash =
|
||||
matchPath({ path: '/invite/:workspaceInviteHash' }, location.pathname)
|
||||
|
||||
@@ -141,18 +141,18 @@ export const useSignInUp = () => {
|
||||
|
||||
if (
|
||||
billing?.isBillingEnabled &&
|
||||
currentWorkspace.subscriptionStatus !== 'active'
|
||||
(!currentWorkspace ||
|
||||
currentWorkspace.subscriptionStatus !== 'active')
|
||||
) {
|
||||
navigate('/plan-required');
|
||||
navigate(AppPath.PlanRequired);
|
||||
return;
|
||||
}
|
||||
if (currentWorkspace?.displayName) {
|
||||
navigate(AppPath.Index);
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentWorkspace.displayName) {
|
||||
navigate('/');
|
||||
return;
|
||||
}
|
||||
|
||||
navigate('/create/workspace');
|
||||
navigate(AppPath.CreateWorkspace);
|
||||
} catch (err: any) {
|
||||
enqueueSnackBar(err?.message, {
|
||||
variant: 'error',
|
||||
|
||||
@@ -27,12 +27,15 @@ export const getOnboardingStatus = ({
|
||||
if (!isLoggedIn) {
|
||||
return OnboardingStatus.OngoingUserCreation;
|
||||
}
|
||||
|
||||
// if the user has not been fetched yet, we can't know the onboarding status
|
||||
if (!currentWorkspaceMember) {
|
||||
if (currentWorkspace && !currentWorkspaceMember) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!currentWorkspace && isBillingEnabled) {
|
||||
return OnboardingStatus.Incomplete;
|
||||
}
|
||||
|
||||
if (
|
||||
isBillingEnabled &&
|
||||
currentWorkspace?.subscriptionStatus === 'incomplete'
|
||||
@@ -48,8 +51,8 @@ export const getOnboardingStatus = ({
|
||||
return OnboardingStatus.OngoingWorkspaceCreation;
|
||||
}
|
||||
if (
|
||||
!currentWorkspaceMember.name.firstName ||
|
||||
!currentWorkspaceMember.name.lastName
|
||||
!currentWorkspaceMember?.name.firstName ||
|
||||
!currentWorkspaceMember?.name.lastName
|
||||
) {
|
||||
return OnboardingStatus.OngoingProfileCreation;
|
||||
}
|
||||
|
||||
@@ -157,13 +157,13 @@ export const PasswordReset = () => {
|
||||
|
||||
if (
|
||||
billing?.isBillingEnabled &&
|
||||
currentWorkspace.subscriptionStatus !== 'active'
|
||||
(!currentWorkspace || currentWorkspace.subscriptionStatus !== 'active')
|
||||
) {
|
||||
navigate(AppPath.PlanRequired);
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentWorkspace.displayName) {
|
||||
if (currentWorkspace?.displayName) {
|
||||
navigate(AppPath.Index);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user