mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-19 15:56:47 +08:00
feat:打开获取cookie
This commit is contained in:
@@ -2,12 +2,12 @@
|
|||||||
* @Author: lixg lixg@dongwu-inc.com
|
* @Author: lixg lixg@dongwu-inc.com
|
||||||
* @Date: 2022-11-21 14:32:52
|
* @Date: 2022-11-21 14:32:52
|
||||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||||
* @LastEditTime: 2022-11-25 15:05:34
|
* @LastEditTime: 2022-11-25 15:52:59
|
||||||
* @FilePath: /fe-manage/src/api/config.js
|
* @FilePath: /fe-manage/src/api/config.js
|
||||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
*/
|
*/
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
// import { getCookie } from '../api/method'
|
import { getCookie } from '../api/method'
|
||||||
// const Qs = require("qs");
|
// const Qs = require("qs");
|
||||||
|
|
||||||
// axios.defaults.headers.post["Content-Type"] =
|
// axios.defaults.headers.post["Content-Type"] =
|
||||||
@@ -24,8 +24,8 @@ const http = axios.create({
|
|||||||
|
|
||||||
http.interceptors.request.use(
|
http.interceptors.request.use(
|
||||||
(config) => {
|
(config) => {
|
||||||
const token = localStorage.getItem("token");
|
// const token = localStorage.getItem("token");
|
||||||
// const token = getCookie('token')
|
const token = getCookie('token')
|
||||||
// console.log('token', token)
|
// console.log('token', token)
|
||||||
if (token) {
|
if (token) {
|
||||||
config.headers.token = token; //测试1111
|
config.headers.token = token; //测试1111
|
||||||
@@ -54,7 +54,7 @@ http.interceptors.response.use(
|
|||||||
if (code === 0 || code === 200) {
|
if (code === 0 || code === 200) {
|
||||||
return response;
|
return response;
|
||||||
} else {
|
} else {
|
||||||
// window.open("https://u-pre.boe.com/web/", '_self');
|
window.open("https://u-pre.boe.com/web/", '_self');
|
||||||
console.log("api %o", msg);
|
console.log("api %o", msg);
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
Reference in New Issue
Block a user