统一前端错误读取和调试日志
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { readError } from '@/shared/utils/error'
|
||||
import { onUnmounted, ref } from 'vue'
|
||||
import { showToast } from 'vant'
|
||||
import { sendSmsCode } from '@/features/auth/api/auth'
|
||||
@@ -51,13 +52,6 @@ export function useSmsCountdown() {
|
||||
}
|
||||
}
|
||||
|
||||
function readError(error: unknown, fallback: string) {
|
||||
if (typeof error === 'object' && error && 'response' in error) {
|
||||
const response = (error as { response?: { data?: { message?: string } } }).response
|
||||
return response?.data?.message || fallback
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
return {
|
||||
countDown,
|
||||
|
||||
Reference in New Issue
Block a user