From 23b069530ce9038edef2488c3dddcc04847a5709 Mon Sep 17 00:00:00 2001 From: nael Date: Sun, 21 Apr 2024 02:13:30 +0200 Subject: [PATCH] :bug: Fix typo --- apps/client-ts/src/components/RootLayout/index.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/client-ts/src/components/RootLayout/index.tsx b/apps/client-ts/src/components/RootLayout/index.tsx index 257aba9f4..d56adefdc 100644 --- a/apps/client-ts/src/components/RootLayout/index.tsx +++ b/apps/client-ts/src/components/RootLayout/index.tsx @@ -11,6 +11,8 @@ import config from '@/lib/config'; import { useStytchUser } from '@stytch/nextjs'; import useProfile from '@/hooks/useProfile'; import useProfileStore from '@/state/profileStore'; +import useProjectStore from '@/state/projectStore'; +import useProjects from '@/hooks/useProjects'; const useDeviceSize = () => { @@ -50,6 +52,15 @@ export const RootLayout = () => { const { profile, setProfile } = useProfileStore(); + const { idProject, setIdProject } = useProjectStore(); + const { data : projects, isLoading: isloadingProjects } = useProjects(); + + useEffect(()=>{ + if(projects && projects[0]){ + setIdProject(projects[0].id_project); + } + },[projects, setIdProject]) + useEffect(()=> { if(data){ //console.log("data is "+ JSON.stringify(data));