Skip to content

Commit

Permalink
🐛 Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Apr 24, 2024
1 parent 0a97d25 commit 01846ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions apps/client-ts/src/components/RootLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ export const RootLayout = () => {

// Effect for fetching projects
useEffect(() => {
if (profile) {
if (profile && profile.id_user) {
console.log("profile is => " + JSON.stringify(profile));
const fetchProjects = async () => {
const response = await fetch(`${config.API_URL}/projects/${profile.id_user}`);
const projectsData = await response.json();
console.log("PROJECTS FETCHED ARE => " + JSON.stringify(projectsData));
setProjects(projectsData as Project[]);
if(projectsData.length > 0){
setProjects(projectsData as Project[]);
setIdProject(projectsData[0].id_user);
}
};
Expand Down
2 changes: 1 addition & 1 deletion apps/client-ts/src/state/projectsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface ProjectsState {
}

const useProjectsStore = create<ProjectsState>()((set) => ({
projects: null,
projects: [],
setProjects: (projects: Project[]) => set({ projects: projects }),
}));

Expand Down

0 comments on commit 01846ed

Please sign in to comment.