diff options
| author | Adam Soltys <[email protected]> | 2022-11-09 14:26:05 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-11-09 14:26:05 -0800 |
| commit | 2be0c31d324e312f7d0b59e910d864d6a1ae99ff (patch) | |
| tree | 8ca8d3af860f371c256df2c1c1e087acbc1841ba /src/lib/utils.js | |
| parent | 692ffd2b6819f6254f77f819a4072eae61a1d638 (diff) | |
| parent | c31cfed30e022acf1c58d8594a1027524f3079da (diff) | |
| download | coinos-ui-2be0c31d324e312f7d0b59e910d864d6a1ae99ff.tar.gz coinos-ui-2be0c31d324e312f7d0b59e910d864d6a1ae99ff.zip | |
Merge branch 'master' into maven
Diffstat (limited to 'src/lib/utils.js')
| -rw-r--r-- | src/lib/utils.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js index 7e0b8e4f..2bf6b800 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); @@ -67,7 +70,7 @@ export function reverseFormat(val, locale) { return Number.isNaN(reversedVal) ? 0 : +reversedVal; } -export let protectedRoutes = [/customers/, /dashboard/, /settings/, /transactions/, /support/]; +export let protectedRoutes = [/customers/, /dashboard/, /settings/, /transactions/]; export const success = (m) => { toast.pop(); |
