mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 18:33:01 +00:00
select first organisation and first project by default
This commit is contained in:
@@ -32,6 +32,7 @@ function Index() {
|
|||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((data: Array<OrganisationResponse>) => {
|
.then((data: Array<OrganisationResponse>) => {
|
||||||
setOrganisations(data);
|
setOrganisations(data);
|
||||||
|
setSelectedOrganisation(data[0] || null);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error("error fetching organisations:", err);
|
console.error("error fetching organisations:", err);
|
||||||
@@ -78,6 +79,12 @@ function Index() {
|
|||||||
});
|
});
|
||||||
}, [selectedProject]);
|
}, [selectedProject]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (projects.length > 0) {
|
||||||
|
setSelectedProject(projects[0]);
|
||||||
|
}
|
||||||
|
}, [projects]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="w-full h-full p-1">
|
<main className="w-full h-full p-1">
|
||||||
{/* header area */}
|
{/* header area */}
|
||||||
|
|||||||
Reference in New Issue
Block a user