mirror of
https://github.com/halo-dev/halo.git
synced 2025-12-20 16:44:38 +08:00
feat: add requests library as a global shared dependency
This commit is contained in:
@@ -15,7 +15,7 @@ import MenuItemEditingModal from "./components/MenuItemEditingModal.vue";
|
||||
import MenuItemListItem from "./components/MenuItemListItem.vue";
|
||||
import MenuList from "./components/MenuList.vue";
|
||||
import { computed, ref } from "vue";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { coreApiClient } from "@halo-dev/api-client";
|
||||
import type { Menu, MenuItem } from "@halo-dev/api-client";
|
||||
import { cloneDeep } from "lodash-es";
|
||||
import type { MenuTreeItem } from "./utils";
|
||||
@@ -51,7 +51,7 @@ const {
|
||||
}
|
||||
|
||||
const menuItemNames = selectedMenu.value.spec.menuItems.filter(Boolean);
|
||||
const { data } = await apiClient.extension.menuItem.listV1alpha1MenuItem({
|
||||
const { data } = await coreApiClient.menuItem.listMenuItem({
|
||||
page: 0,
|
||||
size: 0,
|
||||
fieldSelector: [`name=(${menuItemNames.join(",")})`],
|
||||
@@ -72,8 +72,8 @@ const {
|
||||
});
|
||||
|
||||
const handleOpenEditingModal = (menuItem: MenuTreeItem) => {
|
||||
apiClient.extension.menuItem
|
||||
.getV1alpha1MenuItem({
|
||||
coreApiClient.menuItem
|
||||
.getMenuItem({
|
||||
name: menuItem.metadata.name,
|
||||
})
|
||||
.then((response) => {
|
||||
@@ -106,7 +106,7 @@ const onMenuItemSaved = async (menuItem: MenuItem) => {
|
||||
menuItem.metadata.name,
|
||||
];
|
||||
|
||||
await apiClient.extension.menu.updateV1alpha1Menu({
|
||||
await coreApiClient.menu.updateMenu({
|
||||
name: menuToUpdate.metadata.name,
|
||||
menu: menuToUpdate,
|
||||
});
|
||||
@@ -124,7 +124,7 @@ const handleUpdateInBatch = useDebounceFn(async () => {
|
||||
try {
|
||||
batchUpdating.value = true;
|
||||
const promises = menuItemsToUpdate.map((menuItem) =>
|
||||
apiClient.extension.menuItem.updateV1alpha1MenuItem({
|
||||
coreApiClient.menuItem.updateMenuItem({
|
||||
name: menuItem.metadata.name,
|
||||
menuItem,
|
||||
})
|
||||
@@ -147,7 +147,7 @@ const handleDelete = async (menuItem: MenuTreeItem) => {
|
||||
confirmText: t("core.common.buttons.confirm"),
|
||||
cancelText: t("core.common.buttons.cancel"),
|
||||
onConfirm: async () => {
|
||||
await apiClient.extension.menuItem.deleteV1alpha1MenuItem({
|
||||
await coreApiClient.menuItem.deleteMenuItem({
|
||||
name: menuItem.metadata.name,
|
||||
});
|
||||
|
||||
@@ -155,7 +155,7 @@ const handleDelete = async (menuItem: MenuTreeItem) => {
|
||||
|
||||
if (childrenNames.length) {
|
||||
const deleteChildrenRequests = childrenNames.map((name) =>
|
||||
apiClient.extension.menuItem.deleteV1alpha1MenuItem({
|
||||
coreApiClient.menuItem.deleteMenuItem({
|
||||
name,
|
||||
})
|
||||
);
|
||||
@@ -170,7 +170,7 @@ const handleDelete = async (menuItem: MenuTreeItem) => {
|
||||
menuToUpdate.spec.menuItems = menuToUpdate.spec.menuItems?.filter(
|
||||
(name) => ![menuItem.metadata.name, ...childrenNames].includes(name)
|
||||
);
|
||||
await apiClient.extension.menu.updateV1alpha1Menu({
|
||||
await coreApiClient.menu.updateMenu({
|
||||
name: menuToUpdate.metadata.name,
|
||||
menu: menuToUpdate,
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Toast, VButton, VModal, VSpace } from "@halo-dev/components";
|
||||
import SubmitButton from "@/components/button/SubmitButton.vue";
|
||||
import type { Menu } from "@halo-dev/api-client";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { coreApiClient } from "@halo-dev/api-client";
|
||||
import { setFocus } from "@/formkit/utils/focus";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useQueryClient } from "@tanstack/vue-query";
|
||||
@@ -51,12 +51,12 @@ const handleSaveMenu = async () => {
|
||||
try {
|
||||
saving.value = true;
|
||||
if (props.menu) {
|
||||
await apiClient.extension.menu.updateV1alpha1Menu({
|
||||
await coreApiClient.menu.updateMenu({
|
||||
name: formState.value.metadata.name,
|
||||
menu: formState.value,
|
||||
});
|
||||
} else {
|
||||
const { data } = await apiClient.extension.menu.createV1alpha1Menu({
|
||||
const { data } = await coreApiClient.menu.createMenu({
|
||||
menu: formState.value,
|
||||
});
|
||||
emit("created", data);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Toast, VButton, VModal, VSpace } from "@halo-dev/components";
|
||||
import SubmitButton from "@/components/button/SubmitButton.vue";
|
||||
import { computed, nextTick, onMounted, ref } from "vue";
|
||||
import type { Menu, MenuItem, Ref } from "@halo-dev/api-client";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { coreApiClient } from "@halo-dev/api-client";
|
||||
import { setFocus } from "@/formkit/utils/focus";
|
||||
import AnnotationsForm from "@/components/form/AnnotationsForm.vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
@@ -87,23 +87,21 @@ const handleSaveMenuItem = async () => {
|
||||
}
|
||||
|
||||
if (isUpdateMode) {
|
||||
const { data } =
|
||||
await apiClient.extension.menuItem.updateV1alpha1MenuItem({
|
||||
name: formState.value.metadata.name,
|
||||
menuItem: formState.value,
|
||||
});
|
||||
const { data } = await coreApiClient.menuItem.updateMenuItem({
|
||||
name: formState.value.metadata.name,
|
||||
menuItem: formState.value,
|
||||
});
|
||||
|
||||
emit("saved", data);
|
||||
} else {
|
||||
const { data } =
|
||||
await apiClient.extension.menuItem.createV1alpha1MenuItem({
|
||||
menuItem: formState.value,
|
||||
});
|
||||
const { data } = await coreApiClient.menuItem.createMenuItem({
|
||||
menuItem: formState.value,
|
||||
});
|
||||
|
||||
// if parent menu item is selected, add the new menu item to the parent menu item
|
||||
if (selectedParentMenuItem.value) {
|
||||
const { data: menuItemToUpdate } =
|
||||
await apiClient.extension.menuItem.getV1alpha1MenuItem({
|
||||
await coreApiClient.menuItem.getMenuItem({
|
||||
name: selectedParentMenuItem.value,
|
||||
});
|
||||
|
||||
@@ -112,7 +110,7 @@ const handleSaveMenuItem = async () => {
|
||||
data.metadata.name,
|
||||
];
|
||||
|
||||
await apiClient.extension.menuItem.updateV1alpha1MenuItem({
|
||||
await coreApiClient.menuItem.updateMenuItem({
|
||||
name: menuItemToUpdate.metadata.name,
|
||||
menuItem: menuItemToUpdate,
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
import MenuEditingModal from "./MenuEditingModal.vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import type { Menu } from "@halo-dev/api-client";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { coreApiClient } from "@halo-dev/api-client";
|
||||
import { useRouteQuery } from "@vueuse/router";
|
||||
import { usePermission } from "@/utils/permission";
|
||||
import { useI18n } from "vue-i18n";
|
||||
@@ -48,7 +48,7 @@ const {
|
||||
} = useQuery<Menu[]>({
|
||||
queryKey: ["menus"],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.extension.menu.listV1alpha1Menu({
|
||||
const { data } = await coreApiClient.menu.listMenu({
|
||||
page: 0,
|
||||
size: 0,
|
||||
});
|
||||
@@ -87,12 +87,12 @@ const handleDeleteMenu = async (menu: Menu) => {
|
||||
cancelText: t("core.common.buttons.cancel"),
|
||||
onConfirm: async () => {
|
||||
try {
|
||||
await apiClient.extension.menu.deleteV1alpha1Menu({
|
||||
await coreApiClient.menu.deleteMenu({
|
||||
name: menu.metadata.name,
|
||||
});
|
||||
|
||||
const deleteItemsPromises = menu.spec.menuItems?.map((item) =>
|
||||
apiClient.extension.menuItem.deleteV1alpha1MenuItem({
|
||||
coreApiClient.menuItem.deleteMenuItem({
|
||||
name: item,
|
||||
})
|
||||
);
|
||||
@@ -138,7 +138,7 @@ onMounted(async () => {
|
||||
const { data: primaryMenuName, refetch: refetchPrimaryMenuName } = useQuery({
|
||||
queryKey: ["primary-menu-name"],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.extension.configMap.getV1alpha1ConfigMap({
|
||||
const { data } = await coreApiClient.configMap.getConfigMap({
|
||||
name: "system",
|
||||
});
|
||||
|
||||
@@ -153,17 +153,16 @@ const { data: primaryMenuName, refetch: refetchPrimaryMenuName } = useQuery({
|
||||
});
|
||||
|
||||
const handleSetPrimaryMenu = async (menu: Menu) => {
|
||||
const { data: systemConfigMap } =
|
||||
await apiClient.extension.configMap.getV1alpha1ConfigMap({
|
||||
name: "system",
|
||||
});
|
||||
const { data: systemConfigMap } = await coreApiClient.configMap.getConfigMap({
|
||||
name: "system",
|
||||
});
|
||||
|
||||
if (systemConfigMap.data) {
|
||||
const menuConfigToUpdate = JSON.parse(systemConfigMap.data?.menu || "{}");
|
||||
menuConfigToUpdate.primary = menu.metadata.name;
|
||||
systemConfigMap.data["menu"] = JSON.stringify(menuConfigToUpdate);
|
||||
|
||||
await apiClient.extension.configMap.updateV1alpha1ConfigMap({
|
||||
await coreApiClient.configMap.updateConfigMap({
|
||||
name: "system",
|
||||
configMap: systemConfigMap,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script lang="ts" setup>
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import type { Theme } from "@halo-dev/api-client";
|
||||
import {
|
||||
Dialog,
|
||||
IconMore,
|
||||
@@ -14,6 +12,9 @@ import {
|
||||
VStatusDot,
|
||||
VTag,
|
||||
} from "@halo-dev/components";
|
||||
import type { Theme } from "@halo-dev/api-client";
|
||||
|
||||
import { consoleApiClient } from "@halo-dev/api-client";
|
||||
import type { Ref } from "vue";
|
||||
import { inject, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
@@ -39,7 +40,7 @@ async function handleClearCache() {
|
||||
return;
|
||||
}
|
||||
|
||||
await apiClient.theme.invalidateCache({
|
||||
await consoleApiClient.theme.theme.invalidateCache({
|
||||
name: selectedTheme.value?.metadata.name,
|
||||
});
|
||||
|
||||
@@ -60,7 +61,7 @@ const handleReloadTheme = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
await apiClient.theme.reload({
|
||||
await consoleApiClient.theme.theme.reload({
|
||||
name: selectedTheme.value.metadata.name as string,
|
||||
});
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { Ref } from "vue";
|
||||
import type { ConfigMap, Setting, Theme } from "@halo-dev/api-client";
|
||||
|
||||
// hooks
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { consoleApiClient } from "@halo-dev/api-client";
|
||||
import { useSettingFormConvert } from "@console/composables/use-setting-form";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useQuery, useQueryClient } from "@tanstack/vue-query";
|
||||
@@ -29,7 +29,7 @@ const saving = ref(false);
|
||||
const { data: configMap, suspense } = useQuery<ConfigMap>({
|
||||
queryKey: ["theme-configMap", selectedTheme],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.theme.fetchThemeConfig({
|
||||
const { data } = await consoleApiClient.theme.theme.fetchThemeConfig({
|
||||
name: selectedTheme?.value?.metadata.name as string,
|
||||
});
|
||||
return data;
|
||||
@@ -55,7 +55,7 @@ const handleSaveConfigMap = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
await apiClient.theme.updateThemeConfig({
|
||||
await consoleApiClient.theme.theme.updateThemeConfig({
|
||||
name: selectedTheme?.value?.metadata.name,
|
||||
configMap: configMapToUpdate,
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
VSpace,
|
||||
} from "@halo-dev/components";
|
||||
import type { Theme } from "@halo-dev/api-client";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { consoleApiClient, coreApiClient } from "@halo-dev/api-client";
|
||||
import { toRefs, ref, inject, type Ref } from "vue";
|
||||
import { useThemeLifeCycle } from "../composables/use-theme";
|
||||
import { usePermission } from "@/utils/permission";
|
||||
@@ -63,13 +63,12 @@ const handleCreateTheme = async () => {
|
||||
try {
|
||||
creating.value = true;
|
||||
|
||||
const { data } =
|
||||
await apiClient.extension.theme.createThemeHaloRunV1alpha1Theme({
|
||||
theme: props.theme,
|
||||
});
|
||||
const { data } = await coreApiClient.theme.theme.createTheme({
|
||||
theme: props.theme,
|
||||
});
|
||||
|
||||
// create theme settings
|
||||
apiClient.theme.reload({ name: data.metadata.name });
|
||||
consoleApiClient.theme.theme.reload({ name: data.metadata.name });
|
||||
|
||||
activeTabId.value = "installed";
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import ThemePreviewModal from "../preview/ThemePreviewModal.vue";
|
||||
import ThemeListItem from "../ThemeListItem.vue";
|
||||
import { inject, ref, type Ref } from "vue";
|
||||
import type { Theme } from "@halo-dev/api-client";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { consoleApiClient } from "@halo-dev/api-client";
|
||||
import { useQuery } from "@tanstack/vue-query";
|
||||
import { useThemeStore } from "@console/stores/theme";
|
||||
|
||||
@@ -31,7 +31,7 @@ const {
|
||||
} = useQuery<Theme[]>({
|
||||
queryKey: ["installed-themes"],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.theme.listThemes({
|
||||
const { data } = await consoleApiClient.theme.theme.listThemes({
|
||||
page: 0,
|
||||
size: 0,
|
||||
uninstalled: false,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { inject } from "vue";
|
||||
import type { Ref } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { useThemeStore } from "@console/stores/theme";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { consoleApiClient } from "@halo-dev/api-client";
|
||||
|
||||
const { t } = useI18n();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -54,7 +54,7 @@ const handleCatchExistsException = async (
|
||||
throw new Error("File is required");
|
||||
}
|
||||
|
||||
await apiClient.theme.upgradeTheme({
|
||||
await consoleApiClient.theme.theme.upgradeTheme({
|
||||
name: error.themeName,
|
||||
file: file,
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { VButton, VEmpty, VSpace, VLoading } from "@halo-dev/components";
|
||||
import ThemeListItem from "../ThemeListItem.vue";
|
||||
import type { Theme } from "@halo-dev/api-client";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { consoleApiClient } from "@halo-dev/api-client";
|
||||
import { useQuery } from "@tanstack/vue-query";
|
||||
|
||||
const {
|
||||
@@ -13,7 +13,7 @@ const {
|
||||
} = useQuery<Theme[]>({
|
||||
queryKey: ["not-installed-themes"],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.theme.listThemes({
|
||||
const { data } = await consoleApiClient.theme.theme.listThemes({
|
||||
page: 0,
|
||||
size: 0,
|
||||
uninstalled: true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { consoleApiClient } from "@halo-dev/api-client";
|
||||
import { Dialog, Toast, VButton } from "@halo-dev/components";
|
||||
import { useQueryClient } from "@tanstack/vue-query";
|
||||
import type { Ref } from "vue";
|
||||
@@ -26,7 +26,7 @@ const handleDownloadTheme = async () => {
|
||||
try {
|
||||
downloading.value = true;
|
||||
|
||||
await apiClient.theme.installThemeFromUri({
|
||||
await consoleApiClient.theme.theme.installThemeFromUri({
|
||||
installFromUriRequest: {
|
||||
uri: remoteDownloadUrl.value,
|
||||
},
|
||||
@@ -64,7 +64,7 @@ const handleCatchExistsException = async (
|
||||
confirmText: t("core.common.buttons.confirm"),
|
||||
cancelText: t("core.common.buttons.cancel"),
|
||||
onConfirm: async () => {
|
||||
await apiClient.theme.upgradeThemeFromUri({
|
||||
await consoleApiClient.theme.theme.upgradeThemeFromUri({
|
||||
name: error.themeName,
|
||||
upgradeFromUriRequest: {
|
||||
uri: remoteDownloadUrl.value,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { Dialog, Toast, VDropdown, VDropdownItem } from "@halo-dev/components";
|
||||
import type { Theme } from "@halo-dev/api-client";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { coreApiClient } from "@halo-dev/api-client";
|
||||
import { useQueryClient } from "@tanstack/vue-query";
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -27,7 +27,7 @@ const handleUninstall = async (deleteExtensions?: boolean) => {
|
||||
cancelText: t("core.common.buttons.cancel"),
|
||||
onConfirm: async () => {
|
||||
try {
|
||||
await apiClient.extension.theme.deleteThemeHaloRunV1alpha1Theme({
|
||||
await coreApiClient.theme.theme.deleteTheme({
|
||||
name: props.theme.metadata.name,
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ const handleUninstall = async (deleteExtensions?: boolean) => {
|
||||
const { settingName, configMapName } = props.theme.spec;
|
||||
|
||||
if (settingName) {
|
||||
await apiClient.extension.setting.deleteV1alpha1Setting(
|
||||
await coreApiClient.setting.deleteSetting(
|
||||
{
|
||||
name: settingName,
|
||||
},
|
||||
@@ -47,7 +47,7 @@ const handleUninstall = async (deleteExtensions?: boolean) => {
|
||||
}
|
||||
|
||||
if (configMapName) {
|
||||
await apiClient.extension.configMap.deleteV1alpha1ConfigMap(
|
||||
await coreApiClient.configMap.deleteConfigMap(
|
||||
{
|
||||
name: configMapName,
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import ThemePreviewListItem from "./ThemePreviewListItem.vue";
|
||||
import { useSettingFormConvert } from "@console/composables/use-setting-form";
|
||||
import { useThemeStore } from "@console/stores/theme";
|
||||
import { apiClient, axiosInstance } from "@/utils/api-client";
|
||||
import { axiosInstance, consoleApiClient } from "@halo-dev/api-client";
|
||||
import type {
|
||||
ConfigMap,
|
||||
Setting,
|
||||
@@ -62,7 +62,7 @@ const selectedTheme = ref<Theme>();
|
||||
const { data: themes } = useQuery<Theme[]>({
|
||||
queryKey: ["themes"],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.theme.listThemes({
|
||||
const { data } = await consoleApiClient.theme.theme.listThemes({
|
||||
page: 0,
|
||||
size: 0,
|
||||
uninstalled: false,
|
||||
@@ -129,7 +129,7 @@ const settingsVisible = ref(false);
|
||||
const { data: setting } = useQuery<Setting>({
|
||||
queryKey: ["theme-setting", selectedTheme],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.theme.fetchThemeSetting({
|
||||
const { data } = await consoleApiClient.theme.theme.fetchThemeSetting({
|
||||
name: selectedTheme?.value?.metadata.name as string,
|
||||
});
|
||||
|
||||
@@ -154,7 +154,7 @@ const { data: setting } = useQuery<Setting>({
|
||||
const { data: configMap, refetch: handleFetchConfigMap } = useQuery<ConfigMap>({
|
||||
queryKey: ["theme-configMap", selectedTheme],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.theme.fetchThemeConfig({
|
||||
const { data } = await consoleApiClient.theme.theme.fetchThemeConfig({
|
||||
name: selectedTheme?.value?.metadata.name as string,
|
||||
});
|
||||
return data;
|
||||
@@ -180,7 +180,7 @@ const handleSaveConfigMap = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
await apiClient.theme.updateThemeConfig({
|
||||
await consoleApiClient.theme.theme.updateThemeConfig({
|
||||
name: selectedTheme?.value?.metadata.name,
|
||||
configMap: configMapToUpdate,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { useThemeStore } from "@console/stores/theme";
|
||||
import type { Theme } from "@halo-dev/api-client";
|
||||
import { consoleApiClient } from "@halo-dev/api-client";
|
||||
import { Dialog, Toast } from "@halo-dev/components";
|
||||
import { useFileDialog } from "@vueuse/core";
|
||||
import { storeToRefs } from "pinia";
|
||||
@@ -53,7 +53,7 @@ export function useThemeLifeCycle(
|
||||
try {
|
||||
if (!theme.value) return;
|
||||
|
||||
await apiClient.theme.activateTheme({
|
||||
await consoleApiClient.theme.theme.activateTheme({
|
||||
name: theme.value?.metadata.name,
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ export function useThemeLifeCycle(
|
||||
return;
|
||||
}
|
||||
|
||||
await apiClient.theme.resetThemeConfig({
|
||||
await consoleApiClient.theme.theme.resetThemeConfig({
|
||||
name: theme.value.metadata.name as string,
|
||||
});
|
||||
|
||||
@@ -157,7 +157,7 @@ export function useThemeConfigFile(theme: Ref<Theme | undefined>) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { data } = await apiClient.theme.fetchThemeConfig({
|
||||
const { data } = await consoleApiClient.theme.theme.fetchThemeConfig({
|
||||
name: theme?.value?.metadata.name as string,
|
||||
});
|
||||
if (!data) {
|
||||
@@ -250,14 +250,14 @@ export function useThemeConfigFile(theme: Ref<Theme | undefined>) {
|
||||
if (!theme.value) {
|
||||
return;
|
||||
}
|
||||
const { data } = await apiClient.theme.fetchThemeConfig({
|
||||
const { data } = await consoleApiClient.theme.theme.fetchThemeConfig({
|
||||
name: theme.value.metadata.name as string,
|
||||
});
|
||||
if (!data || !data.data) {
|
||||
return;
|
||||
}
|
||||
const combinedConfigData = combinedConfigMap(data.data, importData);
|
||||
await apiClient.theme.updateThemeConfig({
|
||||
await consoleApiClient.theme.theme.updateThemeConfig({
|
||||
name: theme.value.metadata.name,
|
||||
configMap: {
|
||||
...data,
|
||||
|
||||
@@ -40,7 +40,7 @@ import type { Setting, SettingForm, Theme } from "@halo-dev/api-client";
|
||||
import { usePermission } from "@/utils/permission";
|
||||
import { useThemeStore } from "@console/stores/theme";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { consoleApiClient } from "@halo-dev/api-client";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useQuery } from "@tanstack/vue-query";
|
||||
import { useRouteQuery } from "@vueuse/router";
|
||||
@@ -85,7 +85,7 @@ provide<Ref<Theme | undefined>>("selectedTheme", selectedTheme);
|
||||
const { data: setting } = useQuery<Setting>({
|
||||
queryKey: ["theme-setting", selectedTheme],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.theme.fetchThemeSetting({
|
||||
const { data } = await consoleApiClient.theme.theme.fetchThemeSetting({
|
||||
name: selectedTheme.value?.metadata.name as string,
|
||||
});
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user