From 24a74c4c2cc44256ec95a28a2ab38caaecd51f6d Mon Sep 17 00:00:00 2001 From: shibafu Date: Sun, 23 Aug 2020 13:43:31 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AB=E3=83=BC=E3=83=89=E6=83=85=E5=A0=B1?= =?UTF-8?q?=E3=81=AE=E5=8F=96=E5=BE=97=E3=81=AB=E5=A4=B1=E6=95=97=E3=81=97?= =?UTF-8?q?=E3=81=9F=E6=99=82=E3=81=AB=E3=81=A1=E3=82=83=E3=82=93=E3=81=A8?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=82=92=E4=B8=AD=E6=96=AD=E3=81=95=E3=81=9B?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/tissue.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/assets/js/tissue.ts b/resources/assets/js/tissue.ts index 804ef4d..0d39568 100644 --- a/resources/assets/js/tissue.ts +++ b/resources/assets/js/tissue.ts @@ -1,4 +1,4 @@ -import { fetchGet } from './fetch'; +import { fetchGet, ResponseError } from './fetch'; export function suicide(e: T) { return function (): never { @@ -15,7 +15,12 @@ export function linkCard(el: Element) { } fetchGet('/api/checkin/card', { url }) - .then((response) => response.json()) + .then((response) => { + if (response.ok) { + return response.json(); + } + throw new ResponseError(response); + }) .then((data) => { const metaColumn = el.querySelector('.col-12:last-of-type') || die(); const imageColumn = el.querySelector('.col-12:first-of-type') || die();