From 7714815396b4e86afc5db1af3726fab4edf0ca35 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Sat, 3 Jul 2021 23:07:09 +0200 Subject: viewer: add markdown rendering component Extracted from b170f49 (GH PR #304) --- viewer/src/services/fetchWithCheck.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 viewer/src/services/fetchWithCheck.ts (limited to 'viewer/src/services/fetchWithCheck.ts') 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 @@ +export default class FetchWithCheck { + static async get(url: RequestInfo): Promise { + const response = await fetch(url); + if (!response.ok) throw new Error(`${response.status}: ${response.statusText}`); + return response; + } +} -- cgit v1.2.3