handle expected empty response

This commit is contained in:
Simon
2025-02-17 17:23:26 +07:00
parent c18090e169
commit 59cc177913

View File

@@ -55,8 +55,15 @@ const APIClient = async (
throw new Error('Forbidden: Access denied.');
}
// Try parsing response data
let data;
// expected empty response
if (response.status === 204) {
data = null;
return data;
}
// Try parsing response data
try {
data = await response.json();
} catch (error) {