From 1f800b6d4c9831f74bc5b6509b2353972cb6765f Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Tue, 26 Apr 2022 23:57:06 +0300 Subject: [PATCH] frontend: fix error for 204 response --- frontend/src/request.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/request.js b/frontend/src/request.js index 9b15169..ca28fbc 100644 --- a/frontend/src/request.js +++ b/frontend/src/request.js @@ -27,7 +27,7 @@ export default async function(method, endpoint, auth=true, body=null) { const res = await fetch(endpoint, options); return { success: true, - json: await res.json(), + json: res.status === 204 ? null : await res.json(), ok: res.ok, status: res.status }