mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 12:26:47 +08:00
-- token bug
This commit is contained in:
@@ -242,6 +242,10 @@ const setCookie = (name, value, perpetual) => {
|
|||||||
}
|
}
|
||||||
//获取cookie数据
|
//获取cookie数据
|
||||||
//先写一个方法
|
//先写一个方法
|
||||||
|
export function getCookieForName(name) {
|
||||||
|
return document.cookie?.split(";").find(e => e.includes(name))?.replace(`${name}=`, '') || ''
|
||||||
|
}
|
||||||
|
|
||||||
function getCookie(name) {
|
function getCookie(name) {
|
||||||
//1.获取cookie字符串
|
//1.获取cookie字符串
|
||||||
var cookies = document.cookie;
|
var cookies = document.cookie;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {reactive, ref, toRefs, watch} from "vue";
|
import {reactive, ref, toRefs, watch} from "vue";
|
||||||
import {getCookie} from "@/api/method";
|
import {getCookieForName} from "@/api/method";
|
||||||
import JSONBigInt from 'json-bigint';
|
import JSONBigInt from 'json-bigint';
|
||||||
|
|
||||||
const JSONBigIntStr = JSONBigInt({storeAsString: true});
|
const JSONBigIntStr = JSONBigInt({storeAsString: true});
|
||||||
@@ -143,7 +143,7 @@ export async function request(_url, params) {
|
|||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
token: getCookie('token'),
|
token: getCookieForName('token'),
|
||||||
...method !== 'get' ? {'Content-Type': 'application/json'} : {}
|
...method !== 'get' ? {'Content-Type': 'application/json'} : {}
|
||||||
},
|
},
|
||||||
...method !== 'get' ? {body: JSON.stringify(body)} : {}
|
...method !== 'get' ? {body: JSON.stringify(body)} : {}
|
||||||
|
|||||||
Reference in New Issue
Block a user