plane/space/pages/index.tsx
Anmol Singh Bhatia 557fb2306b 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>
2023-12-07 19:59:35 +05:30

29 lines
776 B
TypeScript

import { useEffect } from "react";
import { NextPage } from "next";
import { useRouter } from "next/router";
import { observer } from "mobx-react-lite";
// 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;
const {
user: { currentUser },
}: RootStore = useMobxStore();
useEffect(() => {
if (next_path && currentUser?.onboarding_step?.profile_complete)
router.push(next_path.toString().replace(/[^a-zA-Z0-9\-._~:/?#[\]@!$&'()*+,;=]/g, ""));
}, [router, next_path, currentUser]);
return <LoginView />;
});
export default Index;