2023-10-04 13:51:04 +00:00
|
|
|
import { useEffect } from "react";
|
2024-03-19 14:38:35 +00:00
|
|
|
import { observer } from "mobx-react-lite";
|
2023-10-04 13:51:04 +00:00
|
|
|
import { NextPage } from "next";
|
|
|
|
import { useRouter } from "next/router";
|
2023-12-07 13:20:09 +00:00
|
|
|
|
|
|
|
// components
|
2024-03-19 14:38:35 +00:00
|
|
|
import { LoginView } from "@/components/views";
|
2023-12-07 13:20:09 +00:00
|
|
|
// store
|
2024-03-19 14:38:35 +00:00
|
|
|
import { useMobxStore } from "@/lib/mobx/store-provider";
|
|
|
|
import { RootStore } from "@/store/root";
|
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;
|