perf: 修改 acounts 创建提示

This commit is contained in:
ibuler
2023-02-01 18:55:08 +08:00
parent 0bc3a9f0e7
commit c9065c88f3
3 changed files with 16 additions and 7 deletions

View File

@@ -234,9 +234,19 @@ export function getDayFuture(days, now) {
export function getErrorResponseMsg(error) {
let msg = ''
const data = error.response && error.response.data || {}
const data = error.response && error.response.data || error
if (data && (data.error || data.msg || data.detail)) {
msg = data.error || data.msg || data.detail
} else if (data && data['non_field_errors']) {
msg = data['non_field_errors'].join(', ')
} else if (Array.isArray(data)) {
msg = data.map((item, i) => {
let msg = getErrorResponseMsg(item)
if (msg) {
msg = `${i + 1}. ${msg}`
}
return msg
}).filter(i => i).join('; ')
}
return msg
}

View File

@@ -102,6 +102,7 @@ export function flashErrorMsg({ response, error }) {
}
let timer = null
function refreshSessionAgeDelay(response) {
if (response.request.responseURL.indexOf('/users/profile/') !== -1) {
return