feat: Sort projects by project_id in descending order on ContractDetailsPage
This commit is contained in:
@@ -35,7 +35,11 @@ export default function ContractDetailsPage() {
|
||||
);
|
||||
if (projectsRes.ok) {
|
||||
const projectsData = await projectsRes.json();
|
||||
setProjects(projectsData);
|
||||
// Sort projects by project_id in descending order (newest first)
|
||||
const sortedProjects = projectsData.sort(
|
||||
(a, b) => b.project_id - a.project_id
|
||||
);
|
||||
setProjects(sortedProjects);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error fetching contract details:", error);
|
||||
|
||||
Reference in New Issue
Block a user