mirror of https://github.com/halo-dev/halo-admin
feat: add cookie header when requesting the api
Signed-off-by: Ryan Wang <i@ryanc.cc>pull/588/head
parent
ae4da4784c
commit
32955a4050
|
@ -1,12 +1,8 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
const token =
|
|
||||||
"eyJhbGciOiJSUzUxMiJ9.eyJpc3MiOiJIYWxvIE93bmVyIiwic3ViIjoiYWRtaW4iLCJleHAiOjE2NTY1NjAzMjQsImlhdCI6MTY1NjQ3MzkyNCwic2NvcGUiOlsiUk9MRV9zdXBlci1yb2xlIl19.CloSZG47VmzUd7uLUHb1q-0mmu0SE3zoRVHVAFeN4P9izXc-Sy2ZZc_3QKQPb4HyfWV1HoFDr2GeOKudbkAJIBvvJ1rr-NLh1szj0le06aeK1U2RqANgR0oI4HxSWrPu9Mnz-r04L1D-KrrmnG7votQ6ekeTPwlKIyEI6zl-0NlCqGdv0g3FV37dDbu8-9QrgtTOvRcpymLYGJ-vY2CqGm1z7vNbgMSneIhbRxe6lXfwkbvjtCp3P3Mkj5_14cAt_FQEUHGYnZZH_dNtdU2NZBpMXIgZYE0CaTBes4ciH1N62cwIT05iBTN_tdmDwEsg-BYjvI5IqVmrt2CwT_IcBg"
|
|
||||||
const axiosInstance = axios.create({
|
const axiosInstance = axios.create({
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${token}`,
|
|
||||||
},
|
|
||||||
baseURL: "http://localhost:8090",
|
baseURL: "http://localhost:8090",
|
||||||
|
withCredentials: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
export { axiosInstance };
|
export { axiosInstance };
|
||||||
|
|
|
@ -7,6 +7,7 @@ import type {
|
||||||
MenuItemType,
|
MenuItemType,
|
||||||
Plugin,
|
Plugin,
|
||||||
} from "@halo-dev/admin-shared";
|
} from "@halo-dev/admin-shared";
|
||||||
|
import { axiosInstance } from "@halo-dev/admin-shared";
|
||||||
import { menus, minimenus, registerMenu } from "./router/menus.config";
|
import { menus, minimenus, registerMenu } from "./router/menus.config";
|
||||||
// setup
|
// setup
|
||||||
import "./setup/setupStyles";
|
import "./setup/setupStyles";
|
||||||
|
@ -16,7 +17,6 @@ import { setupComponents } from "./setup/setupComponents";
|
||||||
import { coreModules } from "./modules";
|
import { coreModules } from "./modules";
|
||||||
import { useScriptTag } from "@vueuse/core";
|
import { useScriptTag } from "@vueuse/core";
|
||||||
import { usePluginStore } from "@/stores/plugin";
|
import { usePluginStore } from "@/stores/plugin";
|
||||||
import { axiosInstance } from "@halo-dev/admin-shared";
|
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|
||||||
|
@ -138,7 +138,6 @@ async function initApp() {
|
||||||
try {
|
try {
|
||||||
loadCoreModules();
|
loadCoreModules();
|
||||||
await loadPluginModules();
|
await loadPluginModules();
|
||||||
|
|
||||||
app.provide<MenuGroupType[]>("menus", menus);
|
app.provide<MenuGroupType[]>("menus", menus);
|
||||||
app.provide<MenuItemType[]>("minimenus", minimenus);
|
app.provide<MenuItemType[]>("minimenus", minimenus);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue