fix: 接口变更/请求方法为大写

This commit is contained in:
TsMask
2025-02-20 10:42:34 +08:00
parent 8bfa73a67a
commit 7322759545
83 changed files with 568 additions and 1388 deletions

View File

@@ -1,7 +1,10 @@
import Cookies from 'js-cookie';
import { TOKEN_COOKIE } from '@/constants/token-constants';
import { localRemove, localSet } from '@/utils/cache-local-utils';
import { CACHE_LOCAL_LOCK_PASSWD, CACHE_LOCAL_MASK } from '@/constants/cache-keys-constants';
import {
CACHE_LOCAL_LOCK_PASSWD,
CACHE_LOCAL_MASK,
} from '@/constants/cache-keys-constants';
/**获取cookis中Token字符串 */
export function getToken(): string {
@@ -10,7 +13,7 @@ export function getToken(): string {
/**设置cookis中Token字符串 */
export function setToken(token: string): void {
Cookies.set(TOKEN_COOKIE, token);
Cookies.set(TOKEN_COOKIE, token || '');
localSet(CACHE_LOCAL_MASK, 'none');
}

View File

@@ -61,7 +61,7 @@ type OptionsType = {
/**请求地址 */
url: string;
/**请求方法 */
method: 'get' | 'post' | 'put' | 'delete' | 'PATCH';
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
/**请求头 */
headers?: HeadersInit;
/**地址栏参数 */
@@ -101,7 +101,7 @@ const FATCH_OPTIONS: OptionsType = {
baseUrl: baseUrl,
timeout: 10_000,
url: '',
method: 'get',
method: 'GET',
headers: {
[APP_REQUEST_HEADER_CODE]: import.meta.env.VITE_APP_CODE,
[APP_REQUEST_HEADER_VERSION]: import.meta.env.VITE_APP_VERSION,
@@ -195,7 +195,7 @@ function beforeRequest(options: OptionsType): OptionsType | Promise<any> {
}
}
if (options.method === 'get') return options;
if (options.method === 'GET') return options;
// 非get参数提交
let body = options.data;