el.xwx.moe/lib/client/getInitialData.ts
2023-03-23 02:41:54 +03:30

21 lines
551 B
TypeScript

import useCollectionStore from "@/store/collections";
import { useEffect } from "react";
import { useSession } from "next-auth/react";
import useTagStore from "@/store/tags";
import useLinkStore from "@/store/links";
export default function () {
const { status } = useSession();
const { setCollections } = useCollectionStore();
const { setTags } = useTagStore();
const { setLinks } = useLinkStore();
useEffect(() => {
if (status === "authenticated") {
setCollections();
setTags();
setLinks();
}
}, [status]);
}