mirror of https://github.com/halo-dev/halo-admin
perf: hide toast on setup page (#740)
#### What type of PR is this? /kind improvement /milestone 2.0 #### What this PR does / why we need it: 在首次初始化页面隐藏 `资源不存在` 的提示,这是由 https://github.com/halo-dev/console/pull/732 带来的问题。 #### Special notes for your reviewer: 测试方式: 1. 准备全新的环境。 2. 进入初始化页面,检查是否存在 `资源不存在` 的提示。 #### Does this PR introduce a user-facing change? ```release-note None ```pull/741/head
parent
debaec537e
commit
97a8bd1075
|
@ -228,7 +228,6 @@ async function initApp() {
|
|||
}
|
||||
|
||||
await loadUserPermissions();
|
||||
await loadActivatedTheme();
|
||||
|
||||
try {
|
||||
await loadPluginModules();
|
||||
|
@ -239,6 +238,10 @@ async function initApp() {
|
|||
// load system setup state
|
||||
const systemStateStore = useSystemStatesStore();
|
||||
await systemStateStore.fetchSystemStates();
|
||||
|
||||
if (systemStateStore.states.isSetup) {
|
||||
await loadActivatedTheme();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} finally {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { apiClient } from "@/utils/api-client";
|
||||
import { defineStore } from "pinia";
|
||||
import axios from "axios";
|
||||
import type { ConfigMap } from "@halo-dev/api-client";
|
||||
|
||||
interface SystemState {
|
||||
isSetup: boolean;
|
||||
|
@ -19,10 +20,14 @@ export const useSystemStatesStore = defineStore({
|
|||
actions: {
|
||||
async fetchSystemStates() {
|
||||
try {
|
||||
const { data } =
|
||||
await apiClient.extension.configMap.getv1alpha1ConfigMap({
|
||||
name: "system-states",
|
||||
});
|
||||
const { data } = await axios.get<ConfigMap>(
|
||||
`${
|
||||
import.meta.env.VITE_API_URL
|
||||
}/api/v1alpha1/configmaps/system-states`,
|
||||
{
|
||||
withCredentials: true,
|
||||
}
|
||||
);
|
||||
|
||||
if (data.data) {
|
||||
this.states = JSON.parse(data.data["states"]);
|
||||
|
|
Loading…
Reference in New Issue