Skip to content

Commit

Permalink
Merge pull request #1652 from Spiteless/ts.1651
Browse files Browse the repository at this point in the history
feat: Restore sort functionality in ProjectList
  • Loading branch information
trillium authored May 31, 2024
2 parents 0f625d8 + b5c431e commit e67c2cd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions client/src/pages/ProjectList.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,21 @@ export default function ProjectList() {

if(user?.accessLevel === 'admin') {
projectData = await projectApiService.fetchProjects();
setProjects(projectData);
}

// if user is not admin, but is a project manager, only show projects they manage
if (user?.accessLevel !== 'admin' && user?.managedProjects.length > 0) {
projectData = await projectApiService.fetchPMProjects(user.managedProjects);
setProjects(projectData);
}
}

//sort the projects alphabetically
projectData = projectData.sort((a, b) =>
a.name?.localeCompare(b.name)
);

setProjects(projectData);
}

fetchAllProjects();
},
[projectApiService, user.accessLevel, user.managedProjects]
Expand Down

0 comments on commit e67c2cd

Please sign in to comment.