mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: redirection after signing in on space
This commit is contained in:
parent
19c65b26d6
commit
8d5ff1a628
@ -19,7 +19,6 @@ export const SignInView = observer(() => {
|
|||||||
const { user: userStore } = useMobxStore();
|
const { user: userStore } = useMobxStore();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { next_path } = router.query;
|
|
||||||
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
@ -34,13 +33,15 @@ export const SignInView = observer(() => {
|
|||||||
const onSignInSuccess = (response: any) => {
|
const onSignInSuccess = (response: any) => {
|
||||||
const isOnboarded = response?.user?.onboarding_step?.profile_complete || false;
|
const isOnboarded = response?.user?.onboarding_step?.profile_complete || false;
|
||||||
|
|
||||||
|
const nextPath = router.asPath.includes("next_path") ? router.asPath.split("/?next_path=")[1] : "/";
|
||||||
|
|
||||||
userStore.setCurrentUser(response?.user);
|
userStore.setCurrentUser(response?.user);
|
||||||
|
|
||||||
if (!isOnboarded) {
|
if (!isOnboarded) {
|
||||||
router.push(`/onboarding?next_path=${next_path}`);
|
router.push(`/onboarding?next_path=${nextPath}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
router.push((next_path ?? "/").toString());
|
router.push((nextPath ?? "/").toString());
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGoogleSignIn = async ({ clientId, credential }: any) => {
|
const handleGoogleSignIn = async ({ clientId, credential }: any) => {
|
||||||
|
@ -62,17 +62,13 @@ class UserStore implements IUserStore {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentPath = window.location.pathname + window.location.search;
|
||||||
this.fetchCurrentUser()
|
this.fetchCurrentUser()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (!this.currentUser) {
|
if (!this.currentUser) window.location.href = `/?next_path=${currentPath}`;
|
||||||
const currentPath = window.location.pathname;
|
else callback();
|
||||||
window.location.href = `/?next_path=${currentPath}`;
|
|
||||||
} else callback();
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => (window.location.href = `/?next_path=${currentPath}`));
|
||||||
const currentPath = window.location.pathname;
|
|
||||||
window.location.href = `/?next_path=${currentPath}`;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchCurrentUser = async () => {
|
fetchCurrentUser = async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user