From 32955a40505bd4f7f771350b80edc54b7121f90b Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 30 Jun 2022 16:20:08 +0800 Subject: [PATCH] feat: add cookie header when requesting the api Signed-off-by: Ryan Wang --- packages/shared/src/utils/api-client.ts | 6 +----- src/main.ts | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/shared/src/utils/api-client.ts b/packages/shared/src/utils/api-client.ts index 226c9901..96791b19 100644 --- a/packages/shared/src/utils/api-client.ts +++ b/packages/shared/src/utils/api-client.ts @@ -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 }; diff --git a/src/main.ts b/src/main.ts index 63691251..8b60bca4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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("menus", menus); app.provide("minimenus", minimenus); } catch (e) {