feat: add cookie header when requesting the api

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/588/head
Ryan Wang 2022-06-30 16:20:08 +08:00
parent ae4da4784c
commit 32955a4050
2 changed files with 2 additions and 7 deletions

View File

@ -1,12 +1,8 @@
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({
headers: {
Authorization: `Bearer ${token}`,
},
baseURL: "http://localhost:8090",
withCredentials: true,
});
export { axiosInstance };

View File

@ -7,6 +7,7 @@ import type {
MenuItemType,
Plugin,
} from "@halo-dev/admin-shared";
import { axiosInstance } from "@halo-dev/admin-shared";
import { menus, minimenus, registerMenu } from "./router/menus.config";
// setup
import "./setup/setupStyles";
@ -16,7 +17,6 @@ import { setupComponents } from "./setup/setupComponents";
import { coreModules } from "./modules";
import { useScriptTag } from "@vueuse/core";
import { usePluginStore } from "@/stores/plugin";
import { axiosInstance } from "@halo-dev/admin-shared";
const app = createApp(App);
@ -138,7 +138,6 @@ async function initApp() {
try {
loadCoreModules();
await loadPluginModules();
app.provide<MenuGroupType[]>("menus", menus);
app.provide<MenuItemType[]>("minimenus", minimenus);
} catch (e) {