mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
19 lines
426 B
TypeScript
19 lines
426 B
TypeScript
import { useEffect } from "react";
|
|
// js cookie
|
|
import Cookie from "js-cookie";
|
|
// mobx store
|
|
import { useMobxStore } from "@/lib/mobx/store-provider";
|
|
|
|
const MobxStoreInit = () => {
|
|
const { user: userStore } = useMobxStore();
|
|
|
|
useEffect(() => {
|
|
const authToken = Cookie.get("accessToken") || null;
|
|
if (authToken) userStore.fetchCurrentUser();
|
|
}, [userStore]);
|
|
|
|
return <></>;
|
|
};
|
|
|
|
export default MobxStoreInit;
|