mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-04 22:49:31 +00:00
handle expected empty response
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user