mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-08 19:16:37 +08:00
feat: 请求判断status
This commit is contained in:
parent
a39197f5d6
commit
f2933484d3
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user