refactor: Update API response handling to access nested data structure

This commit is contained in:
Yusuf İpek
2026-02-07 17:59:37 +03:00
parent 49c3ac61ea
commit f6044f3c24
14 changed files with 45 additions and 37 deletions
+2 -2
View File
@@ -67,7 +67,7 @@ export default function NewProjectPage() {
const res = await fetch('/api/workspaces');
if (res.ok) {
const data = await res.json();
const workspacesData = data.workspaces || [];
const workspacesData = data.data.workspaces || [];
setWorkspaces(workspacesData);
// Auto-select if only one workspace and none preselected
if (!preselectedWorkspace && workspacesData.length === 1) {
@@ -106,7 +106,7 @@ export default function NewProjectPage() {
return;
}
router.push(`/projects/${data.id}`);
router.push(`/projects/${data.data.id}`);
} catch {
setError('Something went wrong. Please try again.');
} finally {