diff options
author | Zero~Informatique | 2021-07-03 23:07:09 +0200 |
---|---|---|
committer | pacien | 2021-07-04 17:07:52 +0200 |
commit | 7714815396b4e86afc5db1af3726fab4edf0ca35 (patch) | |
tree | db9186008b2b9b95fe27d7c878cdd35374e1afec /viewer/src/services/fetchWithCheck.ts | |
parent | dfa1c6e2f2977c32f75c1d93d9e7eb44fbed28c0 (diff) | |
download | ldgallery-7714815396b4e86afc5db1af3726fab4edf0ca35.tar.gz |
viewer: add markdown rendering component
Extracted from b170f49 (GH PR #304)
Diffstat (limited to 'viewer/src/services/fetchWithCheck.ts')
-rw-r--r-- | viewer/src/services/fetchWithCheck.ts | 7 |
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 @@ | |||
1 | export 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 | } | ||