From 5902886798cc51e7f32ca878d74efe4da2194ebb Mon Sep 17 00:00:00 2001 From: miofly <42859910+Miofly@users.noreply.github.com> Date: Tue, 12 Oct 2021 18:30:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(type):=20=E4=BF=AE=E5=A4=8D=E5=87=A0?= =?UTF-8?q?=E4=B8=AA=20ts=20=E6=8A=A5=E9=94=99=EF=BC=8C=E5=92=8C=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=BC=95=E7=94=A8=E4=BD=8D=E7=BD=AE=20(#1283)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(type): 删除多余的类型定义 * fix(login): 删除登录时的 toRaw 包裹参数 * fix(type): 修复几个 ts 报错,和文件引用位置 --- src/router/constant.ts | 2 +- src/utils/http/axios/Axios.ts | 2 +- src/utils/http/axios/index.ts | 4 ++-- src/views/sys/login/LoginForm.vue | 16 +++++++--------- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/router/constant.ts b/src/router/constant.ts index 82d5911fe..d39a67e56 100644 --- a/src/router/constant.ts +++ b/src/router/constant.ts @@ -4,7 +4,7 @@ export const PARENT_LAYOUT_NAME = 'ParentLayout'; export const PAGE_NOT_FOUND_NAME = 'PageNotFound'; -export const EXCEPTION_COMPONENT = () => import('../views/sys/exception/Exception.vue'); +export const EXCEPTION_COMPONENT = () => import('/@/views/sys/exception/Exception.vue'); /** * @description: default layout diff --git a/src/utils/http/axios/Axios.ts b/src/utils/http/axios/Axios.ts index 113c32aea..f2d57be1b 100644 --- a/src/utils/http/axios/Axios.ts +++ b/src/utils/http/axios/Axios.ts @@ -1,5 +1,5 @@ import type { AxiosRequestConfig, AxiosInstance, AxiosResponse, AxiosError } from 'axios'; -import type { RequestOptions, Result, UploadFileParams } from '../../../../types/axios'; +import type { RequestOptions, Result, UploadFileParams } from '/#/axios'; import type { CreateAxiosOptions } from './axiosTransform'; import axios from 'axios'; import qs from 'qs'; diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts index 1e946dc89..c73af07f3 100644 --- a/src/utils/http/axios/index.ts +++ b/src/utils/http/axios/index.ts @@ -140,7 +140,7 @@ const transform: AxiosTransform = { const token = getToken(); if (token && (config as Recordable)?.requestOptions?.withToken !== false) { // jwt token - config.headers.Authorization = options.authenticationScheme + (config as Recordable).headers.Authorization = options.authenticationScheme ? `${options.authenticationScheme} ${token}` : token; } @@ -184,7 +184,7 @@ const transform: AxiosTransform = { return Promise.reject(error); } } catch (error) { - throw new Error(error); + throw new Error(error as unknown as string); } checkStatus(error?.response?.status, msg, errorMessageMode); diff --git a/src/views/sys/login/LoginForm.vue b/src/views/sys/login/LoginForm.vue index d8a0740e8..edc217394 100644 --- a/src/views/sys/login/LoginForm.vue +++ b/src/views/sys/login/LoginForm.vue @@ -82,7 +82,7 @@