mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: onboarded steps validation in web app (#4527)
This commit is contained in:
parent
1355873e32
commit
4c5d66d6d1
@ -37,6 +37,14 @@ export const AuthenticationWrapper: FC<TAuthenticationWrapper> = observer((props
|
|||||||
shouldRetryOnError: false,
|
shouldRetryOnError: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const isUserOnboard =
|
||||||
|
currentUserProfile?.is_onboarded ||
|
||||||
|
(currentUserProfile?.onboarding_step?.profile_complete &&
|
||||||
|
currentUserProfile?.onboarding_step?.workspace_create &&
|
||||||
|
currentUserProfile?.onboarding_step?.workspace_invite &&
|
||||||
|
currentUserProfile?.onboarding_step?.workspace_join) ||
|
||||||
|
false;
|
||||||
|
|
||||||
const getWorkspaceRedirectionUrl = (): string => {
|
const getWorkspaceRedirectionUrl = (): string => {
|
||||||
let redirectionRoute = "/profile";
|
let redirectionRoute = "/profile";
|
||||||
|
|
||||||
@ -72,7 +80,7 @@ export const AuthenticationWrapper: FC<TAuthenticationWrapper> = observer((props
|
|||||||
if (pageType === EPageTypes.NON_AUTHENTICATED) {
|
if (pageType === EPageTypes.NON_AUTHENTICATED) {
|
||||||
if (!currentUser?.id) return <>{children}</>;
|
if (!currentUser?.id) return <>{children}</>;
|
||||||
else {
|
else {
|
||||||
if (currentUserProfile?.id && currentUserProfile?.is_onboarded) {
|
if (currentUserProfile?.id && isUserOnboard) {
|
||||||
const currentRedirectRoute = getWorkspaceRedirectionUrl();
|
const currentRedirectRoute = getWorkspaceRedirectionUrl();
|
||||||
router.push(currentRedirectRoute);
|
router.push(currentRedirectRoute);
|
||||||
return <></>;
|
return <></>;
|
||||||
@ -88,7 +96,7 @@ export const AuthenticationWrapper: FC<TAuthenticationWrapper> = observer((props
|
|||||||
router.push("/sign-in");
|
router.push("/sign-in");
|
||||||
return <></>;
|
return <></>;
|
||||||
} else {
|
} else {
|
||||||
if (currentUser && currentUserProfile?.id && currentUserProfile?.is_onboarded) {
|
if (currentUser && currentUserProfile?.id && isUserOnboard) {
|
||||||
const currentRedirectRoute = getWorkspaceRedirectionUrl();
|
const currentRedirectRoute = getWorkspaceRedirectionUrl();
|
||||||
router.push(currentRedirectRoute);
|
router.push(currentRedirectRoute);
|
||||||
return <></>;
|
return <></>;
|
||||||
@ -101,12 +109,7 @@ export const AuthenticationWrapper: FC<TAuthenticationWrapper> = observer((props
|
|||||||
router.push("/sign-in");
|
router.push("/sign-in");
|
||||||
return <></>;
|
return <></>;
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (currentUser && !currentUser?.is_password_autoset && currentUserProfile?.id && isUserOnboard) {
|
||||||
currentUser &&
|
|
||||||
!currentUser?.is_password_autoset &&
|
|
||||||
currentUserProfile?.id &&
|
|
||||||
currentUserProfile?.is_onboarded
|
|
||||||
) {
|
|
||||||
const currentRedirectRoute = getWorkspaceRedirectionUrl();
|
const currentRedirectRoute = getWorkspaceRedirectionUrl();
|
||||||
router.push(currentRedirectRoute);
|
router.push(currentRedirectRoute);
|
||||||
return <></>;
|
return <></>;
|
||||||
@ -116,7 +119,7 @@ export const AuthenticationWrapper: FC<TAuthenticationWrapper> = observer((props
|
|||||||
|
|
||||||
if (pageType === EPageTypes.AUTHENTICATED) {
|
if (pageType === EPageTypes.AUTHENTICATED) {
|
||||||
if (currentUser?.id) {
|
if (currentUser?.id) {
|
||||||
if (currentUserProfile && currentUserProfile?.id && currentUserProfile?.is_onboarded) return <>{children}</>;
|
if (currentUserProfile && currentUserProfile?.id && isUserOnboard) return <>{children}</>;
|
||||||
else {
|
else {
|
||||||
router.push(`/onboarding`);
|
router.push(`/onboarding`);
|
||||||
return <></>;
|
return <></>;
|
||||||
|
Loading…
Reference in New Issue
Block a user