mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
refactor: Update API response handling to access nested data structure
This commit is contained in:
@@ -68,8 +68,8 @@ export default function WorkspaceMembersPage() {
|
||||
return;
|
||||
}
|
||||
const data = await res.json();
|
||||
setMembers(data.members);
|
||||
setOwner(data.owner);
|
||||
setMembers(data.data.members);
|
||||
setOwner(data.data.owner);
|
||||
} catch {
|
||||
setError('Failed to load members');
|
||||
} finally {
|
||||
|
||||
@@ -63,7 +63,7 @@ export default function NewWorkspaceProjectPage({ params }: { params: Promise<{
|
||||
return;
|
||||
}
|
||||
|
||||
router.push(`/projects/${data.id}`);
|
||||
router.push(`/projects/${data.data.id}`);
|
||||
} catch {
|
||||
setError('Something went wrong. Please try again.');
|
||||
} finally {
|
||||
|
||||
@@ -40,10 +40,11 @@ export default function WorkspaceSettingsPage() {
|
||||
return;
|
||||
}
|
||||
const data = await res.json();
|
||||
setWorkspace(data);
|
||||
const workspace = data.data;
|
||||
setWorkspace(workspace);
|
||||
setFormData({
|
||||
name: data.name,
|
||||
description: data.description || '',
|
||||
name: workspace.name,
|
||||
description: workspace.description || '',
|
||||
});
|
||||
} catch {
|
||||
setError('Failed to load workspace');
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function NewWorkspacePage() {
|
||||
return;
|
||||
}
|
||||
|
||||
router.push(`/workspaces/${data.id}`);
|
||||
router.push(`/workspaces/${data.data.id}`);
|
||||
} catch {
|
||||
setError('Something went wrong. Please try again.');
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user