feat: admin shared package support api client

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/588/head
Ryan Wang 2022-06-27 15:31:16 +08:00
parent 095c74c40f
commit efad1d8268
10 changed files with 9 additions and 22 deletions

View File

@ -29,7 +29,6 @@
"@halo-dev/admin-shared": "workspace:*",
"@halo-dev/components": "workspace:*",
"@vueuse/core": "^8.7.5",
"axios": "^0.27.2",
"filepond": "^4.30.4",
"filepond-plugin-image-preview": "^4.6.11",
"floating-vue": "2.0.0-beta.16",

View File

@ -6,3 +6,5 @@ export * from "./core/plugins";
export * from "./states/pages";
export * from "./types/extension";
export * from "./layouts";
export * from "./utils/api-client";

View File

@ -4,7 +4,7 @@ import { IconUpload, VButton, VTabbar } from "@halo-dev/components";
import { onMounted, provide, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { Starport } from "vue-starport";
import axiosInstance from "@/utils/api-client";
import { axiosInstance } from "@/utils/api-client";
import type { User } from "@/types/extension";
const tabs = [

View File

@ -1,7 +1,7 @@
import axios from "axios";
const token =
"eyJhbGciOiJSUzUxMiJ9.eyJpc3MiOiJIYWxvIE93bmVyIiwic3ViIjoiYWRtaW4iLCJleHAiOjE2NTYxMzk1MzcsImlhdCI6MTY1NjA1MzEzNywic2NvcGUiOlsiUk9MRV9zdXBlci1yb2xlIl19.QUAe5lD2chY5NG_bXwqPxk2y4gxUifz-_H-dN_ZcggdQ0Nm2m5R168VUt33jJ4gCUW5HQx7hqJY_V60jDQ0nAP3VjrfeDNG7BvoaqLyoThg40f1oD-AUoB648b_TZga0oKtwkCyLYi_qkgmvF6UZumMsI9rTVHxef6O5vAbSrFFc2pZ90xNH9PN7ILJDimv_2I1IRpBtASJG1cM0yWYUmHWO-yW2UwUKGxJTf3TN_OvJqHcMRqD7Y5Fe1BVhZfzY8UX6KygG21eKd26hLNIQz6xx-O85HTj8HM5CJUR7jSp3Oo7rtQwIbEDTdGeTqmFM96ufL4nVYdpDuONm0zSxYQ"
"eyJhbGciOiJSUzUxMiJ9.eyJpc3MiOiJIYWxvIE93bmVyIiwic3ViIjoiYWRtaW4iLCJleHAiOjE2NTYzODYyODYsImlhdCI6MTY1NjI5OTg4Niwic2NvcGUiOlsiUk9MRV9zdXBlci1yb2xlIl19.uiBxplxctL3a8G_pNWJzEKEMD-a11VPygHh-yUmm3jaZadt5KWIonkuMl3bSASC96NJn3Lmo1OtSagWIkRWUrWqM4r4_sj3NDOiDpcjxy2msrpe8v9sp_BA4yGjAoaoMBEvdjZ3sQ7L9gJKHhL9bTNsXiSkjS5b7OJLujuF5VFJMp-fmzUDz8-EC5u43wz8MUF88bMk4gUg3nOJYnSTRlrU6759IggEM_0SjZu9wewcLxxa4Vhson_mN6hTObsOyWYjMjTbMlSBQiDfN9IXZ2cRZTnE2me0pT6J0AyP33qBp69B-K0cTaUO2Tcx5_BuWHGUCFUAFwE5FKchGgr6NuA"
const axiosInstance = axios.create({
headers: {
Authorization: `Bearer ${token}`,
@ -9,4 +9,4 @@ const axiosInstance = axios.create({
baseURL: "http://localhost:8090",
});
export default axiosInstance;
export { axiosInstance };

View File

@ -21,7 +21,6 @@ importers:
'@vue/tsconfig': ^0.1.3
'@vueuse/core': ^8.7.5
autoprefixer: ^10.4.7
axios: ^0.27.2
c8: ^7.11.3
cypress: ^9.7.0
eslint: ^8.18.0
@ -61,7 +60,6 @@ importers:
'@halo-dev/admin-shared': link:packages/shared
'@halo-dev/components': link:packages/components
'@vueuse/core': 8.7.5_vue@3.2.37
axios: 0.27.2
filepond: 4.30.4
filepond-plugin-image-preview: 4.6.11_filepond@4.30.4
floating-vue: 2.0.0-beta.16_vue@3.2.37

View File

@ -16,7 +16,7 @@ import { setupComponents } from "./setup/setupComponents";
import { coreModules } from "./modules";
import { useScriptTag } from "@vueuse/core";
import { usePluginStore } from "@/stores/plugin";
import axiosInstance from "@/utils/api-client";
import { axiosInstance } from "@halo-dev/admin-shared";
const app = createApp(App);

View File

@ -12,7 +12,7 @@ import {
import { useRoute } from "vue-router";
import { computed, ref } from "vue";
import type { Plugin } from "@/types/extension";
import axiosInstance from "@/utils/api-client";
import { axiosInstance } from "@halo-dev/admin-shared";
const pluginActiveId = ref("detail");
const plugin = ref<Plugin>();

View File

@ -15,7 +15,7 @@ import {
import { onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import type { Plugin } from "@/types/extension";
import axiosInstance from "@/utils/api-client";
import { axiosInstance } from "@halo-dev/admin-shared";
const checkAll = ref(false);
const plugins = ref<Plugin[]>([]);

View File

@ -14,7 +14,7 @@ import {
} from "@halo-dev/components";
import { ref } from "vue";
import { Starport } from "vue-starport";
import axiosInstance from "@/utils/api-client";
import { axiosInstance } from "@halo-dev/admin-shared";
import type { User } from "@/types/extension";
const checkAll = ref(false);

View File

@ -1,12 +0,0 @@
import axios from "axios";
const token =
"eyJhbGciOiJSUzUxMiJ9.eyJpc3MiOiJIYWxvIE93bmVyIiwic3ViIjoiYWRtaW4iLCJleHAiOjE2NTYxMzk1MzcsImlhdCI6MTY1NjA1MzEzNywic2NvcGUiOlsiUk9MRV9zdXBlci1yb2xlIl19.QUAe5lD2chY5NG_bXwqPxk2y4gxUifz-_H-dN_ZcggdQ0Nm2m5R168VUt33jJ4gCUW5HQx7hqJY_V60jDQ0nAP3VjrfeDNG7BvoaqLyoThg40f1oD-AUoB648b_TZga0oKtwkCyLYi_qkgmvF6UZumMsI9rTVHxef6O5vAbSrFFc2pZ90xNH9PN7ILJDimv_2I1IRpBtASJG1cM0yWYUmHWO-yW2UwUKGxJTf3TN_OvJqHcMRqD7Y5Fe1BVhZfzY8UX6KygG21eKd26hLNIQz6xx-O85HTj8HM5CJUR7jSp3Oo7rtQwIbEDTdGeTqmFM96ufL4nVYdpDuONm0zSxYQ"
const axiosInstance = axios.create({
headers: {
Authorization: `Bearer ${token}`,
},
baseURL: "http://localhost:8090",
});
export default axiosInstance;