aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-11-09 10:53:41 -0800
committerAdam Soltys <[email protected]>2022-11-09 10:53:41 -0800
commit305f26ccefffe52b3fb65995e8caf437f1a92057 (patch)
tree0fd1e422bd8195caccb2837a20d1bd97b94dfa82 /src/lib/utils.js
parentccc13974d22a47995b5f9f674891a39d54aa0620 (diff)
downloadcoinos-ui-305f26ccefffe52b3fb65995e8caf437f1a92057.tar.gz
coinos-ui-305f26ccefffe52b3fb65995e8caf437f1a92057.zip
settings fixes
Diffstat (limited to 'src/lib/utils.js')
-rw-r--r--src/lib/utils.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js
index 7e0b8e4f..c3960487 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -37,7 +37,10 @@ export const get = (url, headers = {}) =>
export const post = (url, body, headers) => {
headers = { ...headers, 'content-type': 'application/json', accept: 'application/json' };
return fetch(base + url, { method: 'POST', body: JSON.stringify(body), headers })
- .then((r) => r.text())
+ .then(async (r) => {
+ if (r.ok) return r.text();
+ throw new Error(await r.text());
+ })
.then((body) => {
try {
body = JSON.parse(body);