fix: verifyToken cannot verify valid token
This commit is contained in:
@@ -30,10 +30,15 @@ export default class DevstarAPIHandler {
|
||||
// 处理非200响应状态码
|
||||
if (!response.ok) {
|
||||
const text = await response.text(); // 先读取文本防止json解析失败
|
||||
throw new Error(`HTTP Error: ${response.status} - ${text}`);
|
||||
if (response.status == 401) {
|
||||
throw new Error('Token错误')
|
||||
} else {
|
||||
throw new Error(`HTTP Error: ${response.status} - ${text}`);
|
||||
}
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
const responseData = await response.json();
|
||||
const data = responseData.data
|
||||
if (data.username == undefined || data.username == "") {
|
||||
throw new Error('Token对应用户不存在')
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user