Skip to content

Commit

Permalink
[*] Fix response condition bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Muska-Ami committed Sep 8, 2024
1 parent 1b73662 commit 4d49752
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
8 changes: 6 additions & 2 deletions src/views/AddProxies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,13 @@ async function addProxy() {
}
if (!rs) return
if (rs.status === 200) {
sendSuccessDialog('添加成功')
if (rs.data.status === 200) {
sendSuccessDialog('添加成功')
} else {
sendErrorMessage(rs.message)
}
} else {
sendErrorMessage(res.data.msg)
sendErrorMessage(rs.message)
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,23 @@ async function login() {
}
let res
try {
res = await api.v2.users.login(model.value.username, model.value.password)
rs = await api.v2.users.login(model.value.username, model.value.password)
} catch (e) {
sendErrorMessage('请求失败: ' + e)
}
if (!res) {
if (!rs) {
ldb.error()
return
}
if (res.status === 200) {
message.success(res.data.username + ',欢迎回来!')
store.commit('set_token', res.data.token)
if (rs.status === 200) {
message.success(rs.data.username + ',欢迎回来!')
store.commit('set_token', rs.data.token)
// console.log(res.data)
store.commit('set_user_info', res.data)
store.commit('set_user_info', rs.data)
router.push(redirect || '/dashboard')
ldb.finish()
} else {
message.warning(res.data.msg)
message.warning(rs.message)
ldb.error()
}
}
Expand Down

0 comments on commit 4d49752

Please sign in to comment.