fix: verifyToken cannot verify valid token

This commit is contained in:
Levi Yan
2025-03-24 16:24:46 +08:00
parent 7087327b4e
commit 4bc9ee4e83

View File

@@ -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 {