aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/services/fetchWithCheck.ts
diff options
context:
space:
mode:
authorpacien2021-07-04 17:38:08 +0200
committerpacien2021-07-04 17:38:08 +0200
commitac160f6879f9a2c74ca77c1c34742d24e69bf570 (patch)
treeaa7af62416126dcf4eff1ba7ac6784b1c65bf22c /viewer/src/services/fetchWithCheck.ts
parentd48a9eb9a75d8e55f78964e884bb94efd23fcd9b (diff)
parent9328223589fac14327223eb38c988cb32b781cbd (diff)
downloadldgallery-ac160f6879f9a2c74ca77c1c34742d24e69bf570.tar.gz
Merge branch 'oz-markdown-component' into develop
Reviewed-by: pacien <pacien.trangirard@pacien.net>
Diffstat (limited to 'viewer/src/services/fetchWithCheck.ts')
-rw-r--r--viewer/src/services/fetchWithCheck.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/viewer/src/services/fetchWithCheck.ts b/viewer/src/services/fetchWithCheck.ts
new file mode 100644
index 0000000..e84e8b6
--- /dev/null
+++ b/viewer/src/services/fetchWithCheck.ts
@@ -0,0 +1,7 @@
1export default class FetchWithCheck {
2 static async get(url: RequestInfo): Promise<Response> {
3 const response = await fetch(url);
4 if (!response.ok) throw new Error(`${response.status}: ${response.statusText}`);
5 return response;
6 }
7}