forked from github/plane
chore: deploy code refactor (#3019)
* chore: deploy code refactor * fix: next_path redirection * fix: sanitized pathname --------- Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
committed by
sriram veeraghanta
parent
8409a84004
commit
557fb2306b
@@ -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 <LoginView />;
|
||||
});
|
||||
|
||||
export default Index;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from "react";
|
||||
|
||||
// components
|
||||
import { LoginView } from "components/views";
|
||||
|
||||
const LoginPage = () => <LoginView />;
|
||||
|
||||
export default LoginPage;
|
||||
Reference in New Issue
Block a user