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