commit 23/09/2025

This commit is contained in:
2025-09-23 13:56:16 +07:00
parent 7c67fe90ee
commit 85ccf05634
8 changed files with 237 additions and 56 deletions

View File

@@ -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();
})