diff --git a/space/components/issues/navbar/index.tsx b/space/components/issues/navbar/index.tsx index bfaeb2466..1aa19bb3a 100644 --- a/space/components/issues/navbar/index.tsx +++ b/space/components/issues/navbar/index.tsx @@ -174,7 +174,7 @@ const IssueNavbar = observer(() => { ) : (
- +
diff --git a/space/hooks/use-sign-in-redirection.tsx b/space/hooks/use-sign-in-redirection.tsx index cf794e38d..306e7985a 100644 --- a/space/hooks/use-sign-in-redirection.tsx +++ b/space/hooks/use-sign-in-redirection.tsx @@ -30,7 +30,7 @@ const useSignInRedirection = (): UseSignInRedirectionProps => { if (isOnboard) { // if next_path is provided, redirect the user to that url if (next_path) router.push(next_path.toString()); - else router.push("/login"); + else router.push("/"); } else { // if the user profile is not complete, redirect them to the onboarding page to complete their profile and then redirect them to the next path if (next_path) router.push(`/onboarding?next_path=${next_path}`); diff --git a/space/pages/index.tsx b/space/pages/index.tsx index 1ff239253..e680c257c 100644 --- a/space/pages/index.tsx +++ b/space/pages/index.tsx @@ -1,19 +1,28 @@ import { useEffect } from "react"; - -// next import { NextPage } from "next"; import { useRouter } from "next/router"; +import { observer } from "mobx-react-lite"; -const Index: NextPage = () => { +// components +import { LoginView } from "components/views"; +// store +import { RootStore } from "store/root"; +import { useMobxStore } from "lib/mobx/store-provider"; + +const Index: NextPage = observer(() => { const router = useRouter(); - const { next_path } = router.query as { next_path: string }; + const { next_path } = router.query; + + const { + user: { currentUser }, + }: RootStore = useMobxStore(); useEffect(() => { - if (next_path) router.push(`/login?next_path=${next_path}`); - else router.push(`/login`); - }, [router, next_path]); + if (next_path && currentUser?.onboarding_step?.profile_complete) + router.push(next_path.toString().replace(/[^a-zA-Z0-9\-._~:/?#[\]@!$&'()*+,;=]/g, "")); + }, [router, next_path, currentUser]); - return null; -}; + return ; +}); export default Index; diff --git a/space/pages/login/index.tsx b/space/pages/login/index.tsx deleted file mode 100644 index 9f20f099f..000000000 --- a/space/pages/login/index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import React from "react"; - -// components -import { LoginView } from "components/views"; - -const LoginPage = () => ; - -export default LoginPage; diff --git a/yarn.lock b/yarn.lock index 803857bfc..d6353dc89 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2797,7 +2797,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^18.2.39", "@types/react@^18.2.42": +"@types/react@*", "@types/react@18.2.42", "@types/react@^18.2.39", "@types/react@^18.2.42": version "18.2.42" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.42.tgz#6f6b11a904f6d96dda3c2920328a97011a00aba7" integrity sha512-c1zEr96MjakLYus/wPnuWDo1/zErfdU9rNsIGmE+NV71nx88FG9Ttgo5dqorXTu/LImX2f63WBP986gJkMPNbA==