plane/space/pages/index.tsx

29 lines
782 B
TypeScript
Raw Normal View History

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