Commit 680eaf2fdb8e885880cc6a1b53e4823a0dc9149f
1 parent
2dbb8146
fix: DEFECT-939 validate form faild loading button has been spinning
Showing
2 changed files
with
12 additions
and
25 deletions
... | ... | @@ -117,15 +117,16 @@ const transform: AxiosTransform = { |
117 | 117 | const errorLogStore = useErrorLogStoreWithOut(); |
118 | 118 | errorLogStore.addAjaxErrorInfo(error); |
119 | 119 | const { response, code, message, config } = error || {}; |
120 | + | |
120 | 121 | const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none'; |
121 | - const errorMsgIsObj = typeof response.data === 'object'; | |
122 | + const errorMsgIsObj = typeof response?.data === 'object'; | |
122 | 123 | const msg: string = errorMsgIsObj |
123 | 124 | ? response?.data?.message || response?.data?.msg |
124 | - : response.data; | |
125 | + : response?.data; | |
125 | 126 | const err: string = error?.toString?.() ?? ''; |
126 | 127 | let errMessage = ''; |
127 | 128 | try { |
128 | - if (response.data.status == '401' || response.data.message == '"Authentication failed"') { | |
129 | + if (response?.data?.status == '401' || response?.data?.message == '"Authentication failed"') { | |
129 | 130 | window.localStorage.clear(); |
130 | 131 | window.sessionStorage.clear(); |
131 | 132 | router.push(PageEnum.BASE_HOME); | ... | ... |
... | ... | @@ -40,7 +40,6 @@ |
40 | 40 | import { FileItem } from '/@/components/Upload/src/typing'; |
41 | 41 | import { upload } from '/@/api/oss/ossFileUploader'; |
42 | 42 | import { getTenantRoles, updateOrCreateTenant } from '/@/api/tenant/tenantApi'; |
43 | - import { useMessage } from '/@/hooks/web/useMessage'; | |
44 | 43 | export default defineComponent({ |
45 | 44 | name: 'TenantDrawer', |
46 | 45 | components: { |
... | ... | @@ -140,29 +139,16 @@ |
140 | 139 | entityType: 'TENANT_PROFILE', |
141 | 140 | }, |
142 | 141 | }; |
143 | - updateOrCreateTenant(req) | |
144 | - .then((res) => { | |
145 | - console.log(res); | |
146 | - closeDrawer(); //关闭侧框 | |
147 | - emit('success'); | |
148 | - setTimeout(() => { | |
149 | - setDrawerProps({ confirmLoading: false }); | |
150 | - }, 300); | |
151 | - }) | |
152 | - .catch((e) => { | |
153 | - const { createMessage } = useMessage(); | |
154 | - createMessage.error(`${e.message}`); | |
155 | - }) | |
156 | - .finally(() => { | |
157 | - setTimeout(() => { | |
158 | - setDrawerProps({ confirmLoading: false }); | |
159 | - }, 300); | |
160 | - }); | |
142 | + await updateOrCreateTenant(req); | |
143 | + emit('success'); | |
144 | + closeDrawer(); //关闭侧框 | |
161 | 145 | } catch (e) { |
146 | + if ((e as { code: string }).code === 'ECONNABORTED') { | |
147 | + emit('success'); | |
148 | + closeDrawer(); //关闭侧框 | |
149 | + } | |
162 | 150 | } finally { |
163 | - setTimeout(() => { | |
164 | - setDrawerProps({ confirmLoading: false }); | |
165 | - }, 300); | |
151 | + setDrawerProps({ confirmLoading: false }); | |
166 | 152 | } |
167 | 153 | } |
168 | 154 | return { | ... | ... |