el.xwx.moe/lib/client/getInitialData.ts

18 lines
451 B
TypeScript
Raw Normal View History

2023-02-18 21:32:02 -06:00
import useCollectionSlice from "@/store/collection";
import { useEffect } from "react";
import { useSession } from "next-auth/react";
import useTagSlice from "@/store/tags";
2023-02-18 21:32:02 -06:00
export default function () {
2023-02-18 21:32:02 -06:00
const { status } = useSession();
const { setCollections } = useCollectionSlice();
const { setTags } = useTagSlice();
2023-02-18 21:32:02 -06:00
useEffect(() => {
if (status === "authenticated") {
setCollections();
setTags();
2023-02-18 21:32:02 -06:00
}
}, [status]);
}