40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { useModuleStore } from "../../lib/store/useModuleStore";
|
|
import { useEffect } from "react";
|
|
import { useSettingStore } from "@/lib/store/useSettings";
|
|
import { useGetUserRoles } from "@/lib/store/useGetRoles";
|
|
import { useSubModuleStore } from "@/lib/store/useSubModuleStore";
|
|
|
|
const queryClient = new QueryClient();
|
|
|
|
export const SessionProvider = ({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) => {
|
|
const { fetchModules } = useModuleStore();
|
|
const { fetchSettings } = useSettingStore();
|
|
const { fetchUserRoles } = useGetUserRoles();
|
|
const { fetchSubModules } = useSubModuleStore();
|
|
|
|
useEffect(() => {
|
|
fetchModules();
|
|
fetchSettings();
|
|
console.log("settings grab ran");
|
|
fetchUserRoles();
|
|
fetchSubModules();
|
|
}, []);
|
|
|
|
//temp
|
|
localStorage.removeItem("ally-supports-cache");
|
|
localStorage.removeItem("auth-storage");
|
|
localStorage.removeItem("nextauth.message");
|
|
localStorage.removeItem("prod");
|
|
localStorage.removeItem("card-storage");
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
{children}
|
|
</QueryClientProvider>
|
|
);
|
|
};
|