Rename project applications loader
cgen-a18fcc2952e3401895bd73edcb545a5c
This commit is contained in:
parent
df7329b9ce
commit
3b7ed56d19
1 changed files with 9 additions and 9 deletions
|
|
@ -132,30 +132,30 @@ export default function Admin() {
|
||||||
.catch(() => void 0);
|
.catch(() => void 0);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const loadApplications = useCallback(async () => {
|
const loadProjectApplications = useCallback(async () => {
|
||||||
if (!user?.id) return;
|
if (!user?.id) return;
|
||||||
setApplicationsLoading(true);
|
setProjectApplicationsLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`/api/applications?owner=${encodeURIComponent(user.id)}`,
|
`/api/applications?owner=${encodeURIComponent(user.id)}`,
|
||||||
);
|
);
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setApplications(Array.isArray(data) ? data : []);
|
setProjectApplications(Array.isArray(data) ? data : []);
|
||||||
} else {
|
} else {
|
||||||
setApplications([]);
|
setProjectApplications([]);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn("Failed to load applications:", error);
|
console.warn("Failed to load project applications:", error);
|
||||||
setApplications([]);
|
setProjectApplications([]);
|
||||||
} finally {
|
} finally {
|
||||||
setApplicationsLoading(false);
|
setProjectApplicationsLoading(false);
|
||||||
}
|
}
|
||||||
}, [user?.id]);
|
}, [user?.id]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadApplications().catch(() => undefined);
|
loadProjectApplications().catch(() => undefined);
|
||||||
}, [loadApplications]);
|
}, [loadProjectApplications]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!loading) {
|
if (!loading) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue