build(projects): update tsconfig、eslintrc

This commit is contained in:
Soybean
2022-03-12 16:21:40 +08:00
parent 4093dcd6dc
commit 75de2b0604
131 changed files with 1174 additions and 1140 deletions

View File

@ -9,8 +9,8 @@ import { fetchUpdateToken } from '../api';
*/
export async function refreshToken(axiosConfig: AxiosRequestConfig) {
const { resetAuthStore } = useAuthStore();
const refreshToken = getRefreshToken();
const { data } = await fetchUpdateToken(refreshToken);
const rToken = getRefreshToken();
const { data } = await fetchUpdateToken(rToken);
if (data) {
setToken(data.token);
setRefreshToken(data.refreshToken);

View File

@ -7,7 +7,7 @@ import {
handleAxiosError,
handleResponseError,
handleBackendError,
handleServiceResult
handleServiceResult,
} from '@/utils';
import { refreshToken } from './helpers';
@ -31,7 +31,7 @@ export default class CustomAxiosInstance {
codeKey: 'code',
dataKey: 'data',
msgKey: 'message',
successCode: 200
successCode: 200,
}
) {
this.backendConfig = backendConfig;
@ -42,7 +42,7 @@ export default class CustomAxiosInstance {
/** 设置请求拦截器 */
setInterceptor() {
this.instance.interceptors.request.use(
async config => {
async (config) => {
const handleConfig = { ...config };
if (handleConfig.headers) {
// 数据转换
@ -59,7 +59,7 @@ export default class CustomAxiosInstance {
}
);
this.instance.interceptors.response.use(
async response => {
async (response) => {
const { status } = response;
if (status === 200 || status < 300 || status === 304) {
const backend = response.data;

View File

@ -85,7 +85,7 @@ export function createRequest(axiosConfig: AxiosRequestConfig, backendConfig?: S
get,
post,
put,
delete: handleDelete
delete: handleDelete,
};
}
@ -138,7 +138,7 @@ export function createHookRequest(axiosConfig: AxiosRequestConfig, backendConfig
data,
error,
loading,
network
network,
};
}
@ -183,7 +183,7 @@ export function createHookRequest(axiosConfig: AxiosRequestConfig, backendConfig
get,
post,
put,
delete: handleDelete
delete: handleDelete,
};
}