Commit 135caac0fc7c0a3287989879a971b7eeb5f75326

Authored by ww
1 parent eb141885

fix: DEFECT-1731 修复重复提示

... ... @@ -2,12 +2,10 @@
2 2 import { ref, unref } from 'vue'
3 3 import { Button, InputGroup, InputPassword, Modal } from 'ant-design-vue'
4 4 import { Icon } from '@iconify/vue'
5   -import type { AxiosError } from 'axios'
6 5 import { useParseParams } from '../LoadData'
7 6 import { BasicForm, useForm } from '@/components/Form'
8 7 import { ComponentEnum, FormLayoutEnum } from '@/components/Form/src/enum'
9 8 import { getShareDataByAccessCredentials } from '@/api/content'
10   -import { useMessage } from '@/hooks/web/useMessage'
11 9 import type { ConfigurationContentType } from '@/api/content/model'
12 10
13 11 enum FormField {
... ... @@ -40,7 +38,6 @@ const open = async (): Promise<ConfigurationContentType> => {
40 38 }
41 39 const { configurationId } = useParseParams()
42 40
43   -const { createMessage } = useMessage()
44 41 const handleOk = async () => {
45 42 await validate()
46 43 const value = getFieldsValue()
... ... @@ -50,8 +47,6 @@ const handleOk = async () => {
50 47 visible.value = false
51 48 }
52 49 catch (error) {
53   - if (((error as AxiosError)?.response?.data as Record<'msg', string>)?.msg)
54   - createMessage.error(((error as AxiosError)?.response?.data as Record<'msg', string>)?.msg)
55 50 }
56 51 }
57 52
... ...
... ... @@ -131,7 +131,8 @@ const transform: AxiosTransform = {
131 131 responseInterceptorsCatch: (_axiosInstance: AxiosInstance, error: any) => {
132 132 const { response, code, message, config } = error || {}
133 133 const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none'
134   - const msg: string = response?.data?.message || response?.data || ''
  134 + let msg: string = response?.data?.message || response?.data?.msg || response?.data || ''
  135 + msg = isString(msg) ? msg : ''
135 136 const err: string = error?.toString?.() ?? ''
136 137 let errMessage = ''
137 138 if (axios.isCancel(error))
... ...