Fix API error handling to correctly parse error details

This commit is contained in:
MartinBraquet
2026-03-19 17:16:02 +01:00
parent be22658883
commit e83ec6506c

View File

@@ -50,7 +50,8 @@ export async function typedAPICall<P extends APIPath>(
}
if (!resp.ok) {
throw new APIError(resp.status as any, json?.error?.message, json?.error?.details)
json = json?.error ?? json
throw new APIError(resp.status as any, json?.message, json?.details)
}
return json
}) as APIResponse<P>