commit 23/09/2025
This commit is contained in:
@@ -69,9 +69,16 @@ function fetchAPI(endpoint, method, headers = {}, body = null, cbOK, cbError) {
|
||||
}
|
||||
}
|
||||
fetch(url, options)
|
||||
.then(response => {
|
||||
.then(async(response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok ' + response.statusText);
|
||||
let msg ;
|
||||
try{
|
||||
let _xxx = await response.json();
|
||||
msg = _xxx.message || response.statusText;
|
||||
} catch {
|
||||
msg = await response.statusText;
|
||||
}
|
||||
throw new Error(msg);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user