Fix async handling for API response in updateProfile and workspace functions

This commit is contained in:
2025-05-24 14:10:35 +02:00
parent 07e0647174
commit 34ac76b87d
2 changed files with 5 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ export const updateProfile = async (
method: 'PUT',
body: JSON.stringify(updateRequest),
});
const data: unknown = response.json();
const data: unknown = await response.json();
if (!isUser(data)) {
throw new Error('Invalid user data');

View File

@@ -54,11 +54,11 @@ export const getWorkspace = async (
const response = await apiCall(
`${API_BASE_URL}/workspaces/${encodeURIComponent(workspaceName)}`
);
const data = response.json();
const data: unknown = await response.json();
if (!isWorkspace(data)) {
throw new Error('Invalid workspace object received from API');
}
return data as Workspace;
return data;
};
/**
@@ -82,11 +82,11 @@ export const updateWorkspace = async (
body: JSON.stringify(workspaceData),
}
);
const data = response.json();
const data: unknown = await response.json();
if (!isWorkspace(data)) {
throw new Error('Invalid workspace object received from API');
}
return data as Workspace;
return data;
};
/**