From f2933484d3c470c601f912ece482a08b93e08a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=E5=BC=A0=E5=98=89=E5=AE=81=E2=80=9D?= <“zhangjianing@zhiketong.cn”> Date: Tue, 4 Apr 2023 16:14:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=B7=E6=B1=82=E5=88=A4=E6=96=ADsta?= =?UTF-8?q?tus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/requests.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/requests.ts b/app/requests.ts index 7646f05db..84ab1d893 100644 --- a/app/requests.ts +++ b/app/requests.ts @@ -44,7 +44,18 @@ function getHeaders() { export function validUser(signature: String) { return fetch(`//uc.zhiketong.net/api/check_user_white/?signature=${window.encodeURIComponent(`${signature}`)}`) - .then((response) => response.json()) + .then((response) => { + // 检查请求的status + if (response.status !== 200) { + return { + data: { + code: response.status + }, + error: null + } + } + return response.json() + }) .then((data) => { return { data,