fix request functionr return values
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
e72ca340c9
commit
216f8bede9
@ -138,15 +138,9 @@ export async function requestAPI (path, method, body = null) {
|
||||
async function request (url, content) {
|
||||
let response = await fetch(url, content)
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new ResponseError(`recieved response status code ${response.status}`);
|
||||
}
|
||||
return response;
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error instanceof ResponseError) {
|
||||
throw error;
|
||||
}
|
||||
throw new NetworkError(error);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user