feat: 请求判断status

This commit is contained in:
“张嘉宁” 2023-04-04 16:14:00 +08:00
parent a39197f5d6
commit f2933484d3

View File

@ -44,7 +44,18 @@ function getHeaders() {
export function validUser(signature: String) { export function validUser(signature: String) {
return fetch(`//uc.zhiketong.net/api/check_user_white/?signature=${window.encodeURIComponent(`${signature}`)}`) 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) => { .then((data) => {
return { return {
data, data,