mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2026-01-22 15:40:21 +08:00
fix: 优化接口异常弹窗及消息提醒方式
This commit is contained in:
@@ -10,10 +10,10 @@
|
||||
import { useAuthStore } from '@/store'
|
||||
|
||||
let isConfirming = false
|
||||
export function resolveResError(code, message) {
|
||||
export function resolveResError(code, message, needTip = true) {
|
||||
switch (code) {
|
||||
case 401:
|
||||
if (isConfirming)
|
||||
if (isConfirming || !needTip)
|
||||
return
|
||||
isConfirming = true
|
||||
$dialog.confirm({
|
||||
@@ -32,7 +32,7 @@ export function resolveResError(code, message) {
|
||||
return false
|
||||
case 11007:
|
||||
case 11008:
|
||||
if (isConfirming)
|
||||
if (isConfirming || !needTip)
|
||||
return
|
||||
isConfirming = true
|
||||
$dialog.confirm({
|
||||
@@ -62,5 +62,6 @@ export function resolveResError(code, message) {
|
||||
message = message ?? `【${code}】: 未知异常!`
|
||||
break
|
||||
}
|
||||
needTip && window.$message?.error(message)
|
||||
return message
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user