diff --git a/src/utils/http/helpers.js b/src/utils/http/helpers.js index 617779f..3d6d0f3 100644 --- a/src/utils/http/helpers.js +++ b/src/utils/http/helpers.js @@ -3,12 +3,6 @@ import { isNullOrUndef } from '@/utils/is' import { removeToken } from '@/utils/token' import { toLogin } from '@/utils/auth' -const WITHOUT_TOKEN_API = [{ url: '/auth/login', method: 'POST' }] - -export function isWithoutToken({ url, method = '' }) { - return WITHOUT_TOKEN_API.some((item) => item.url === url && item.method === method.toUpperCase()) -} - export function addBaseParams(params) { if (!params.userId) { params.userId = useUserStore().userId diff --git a/src/utils/http/interceptors.js b/src/utils/http/interceptors.js index 9ed9570..d2b1eeb 100644 --- a/src/utils/http/interceptors.js +++ b/src/utils/http/interceptors.js @@ -1,10 +1,10 @@ import { getToken } from '@/utils/token' import { toLogin } from '@/utils/auth' -import { isWithoutToken, resolveResError } from './helpers' +import { resolveResError } from './helpers' export function reqResolve(config) { // 处理不需要token的请求 - if (isWithoutToken(config)) { + if (config.noNeedToken) { return config } diff --git a/src/views/login/api.js b/src/views/login/api.js index bebc2ea..d8ca988 100644 --- a/src/views/login/api.js +++ b/src/views/login/api.js @@ -1,5 +1,5 @@ import request from '@/utils/http' export default { - login: (data) => request.post('/auth/login', data), + login: (data) => request.post('/auth/login', data, { noNeedToken: true }), }