Commit 5902886798cc51e7f32ca878d74efe4da2194ebb
Committed by
GitHub
1 parent
7a1b6e74
fix(type): 修复几个 ts 报错,和文件引用位置 (#1283)
* fix(type): 删除多余的类型定义 * fix(login): 删除登录时的 toRaw 包裹参数 * fix(type): 修复几个 ts 报错,和文件引用位置
Showing
4 changed files
with
11 additions
and
13 deletions
src/router/constant.ts
... | ... | @@ -4,7 +4,7 @@ export const PARENT_LAYOUT_NAME = 'ParentLayout'; |
4 | 4 | |
5 | 5 | export const PAGE_NOT_FOUND_NAME = 'PageNotFound'; |
6 | 6 | |
7 | -export const EXCEPTION_COMPONENT = () => import('../views/sys/exception/Exception.vue'); | |
7 | +export const EXCEPTION_COMPONENT = () => import('/@/views/sys/exception/Exception.vue'); | |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @description: default layout | ... | ... |
src/utils/http/axios/Axios.ts
1 | 1 | import type { AxiosRequestConfig, AxiosInstance, AxiosResponse, AxiosError } from 'axios'; |
2 | -import type { RequestOptions, Result, UploadFileParams } from '../../../../types/axios'; | |
2 | +import type { RequestOptions, Result, UploadFileParams } from '/#/axios'; | |
3 | 3 | import type { CreateAxiosOptions } from './axiosTransform'; |
4 | 4 | import axios from 'axios'; |
5 | 5 | import qs from 'qs'; | ... | ... |
src/utils/http/axios/index.ts
... | ... | @@ -140,7 +140,7 @@ const transform: AxiosTransform = { |
140 | 140 | const token = getToken(); |
141 | 141 | if (token && (config as Recordable)?.requestOptions?.withToken !== false) { |
142 | 142 | // jwt token |
143 | - config.headers.Authorization = options.authenticationScheme | |
143 | + (config as Recordable).headers.Authorization = options.authenticationScheme | |
144 | 144 | ? `${options.authenticationScheme} ${token}` |
145 | 145 | : token; |
146 | 146 | } |
... | ... | @@ -184,7 +184,7 @@ const transform: AxiosTransform = { |
184 | 184 | return Promise.reject(error); |
185 | 185 | } |
186 | 186 | } catch (error) { |
187 | - throw new Error(error); | |
187 | + throw new Error(error as unknown as string); | |
188 | 188 | } |
189 | 189 | |
190 | 190 | checkStatus(error?.response?.status, msg, errorMessageMode); | ... | ... |
src/views/sys/login/LoginForm.vue
... | ... | @@ -82,7 +82,7 @@ |
82 | 82 | </Form> |
83 | 83 | </template> |
84 | 84 | <script lang="ts" setup> |
85 | - import { reactive, ref, toRaw, unref, computed } from 'vue'; | |
85 | + import { reactive, ref, unref, computed } from 'vue'; | |
86 | 86 | |
87 | 87 | import { Checkbox, Form, Input, Row, Col, Button, Divider } from 'ant-design-vue'; |
88 | 88 | import { |
... | ... | @@ -134,13 +134,11 @@ |
134 | 134 | if (!data) return; |
135 | 135 | try { |
136 | 136 | loading.value = true; |
137 | - const userInfo = await userStore.login( | |
138 | - { | |
139 | - password: data.password, | |
140 | - username: data.account, | |
141 | - mode: 'none', //不要默认的错误提示 | |
142 | - }, | |
143 | - ); | |
137 | + const userInfo = await userStore.login({ | |
138 | + password: data.password, | |
139 | + username: data.account, | |
140 | + mode: 'none', //不要默认的错误提示 | |
141 | + }); | |
144 | 142 | if (userInfo) { |
145 | 143 | notification.success({ |
146 | 144 | message: t('sys.login.loginSuccessTitle'), |
... | ... | @@ -151,7 +149,7 @@ |
151 | 149 | } catch (error) { |
152 | 150 | createErrorModal({ |
153 | 151 | title: t('sys.api.errorTip'), |
154 | - content: error.message || t('sys.api.networkExceptionMsg'), | |
152 | + content: (error as unknown as Error).message || t('sys.api.networkExceptionMsg'), | |
155 | 153 | getContainer: () => document.body.querySelector(`.${prefixCls}`) || document.body, |
156 | 154 | }); |
157 | 155 | } finally { | ... | ... |