mirror of https://github.com/halo-dev/halo
perf: hide toast on setup page (halo-dev/console#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/3445/head
parent
5141648f52
commit
06030165f5
|
@ -228,7 +228,6 @@ async function initApp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
await loadUserPermissions();
|
await loadUserPermissions();
|
||||||
await loadActivatedTheme();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await loadPluginModules();
|
await loadPluginModules();
|
||||||
|
@ -239,6 +238,10 @@ async function initApp() {
|
||||||
// load system setup state
|
// load system setup state
|
||||||
const systemStateStore = useSystemStatesStore();
|
const systemStateStore = useSystemStatesStore();
|
||||||
await systemStateStore.fetchSystemStates();
|
await systemStateStore.fetchSystemStates();
|
||||||
|
|
||||||
|
if (systemStateStore.states.isSetup) {
|
||||||
|
await loadActivatedTheme();
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { apiClient } from "@/utils/api-client";
|
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
|
import axios from "axios";
|
||||||
|
import type { ConfigMap } from "@halo-dev/api-client";
|
||||||
|
|
||||||
interface SystemState {
|
interface SystemState {
|
||||||
isSetup: boolean;
|
isSetup: boolean;
|
||||||
|
@ -19,10 +20,14 @@ export const useSystemStatesStore = defineStore({
|
||||||
actions: {
|
actions: {
|
||||||
async fetchSystemStates() {
|
async fetchSystemStates() {
|
||||||
try {
|
try {
|
||||||
const { data } =
|
const { data } = await axios.get<ConfigMap>(
|
||||||
await apiClient.extension.configMap.getv1alpha1ConfigMap({
|
`${
|
||||||
name: "system-states",
|
import.meta.env.VITE_API_URL
|
||||||
});
|
}/api/v1alpha1/configmaps/system-states`,
|
||||||
|
{
|
||||||
|
withCredentials: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (data.data) {
|
if (data.data) {
|
||||||
this.states = JSON.parse(data.data["states"]);
|
this.states = JSON.parse(data.data["states"]);
|
||||||
|
|
Loading…
Reference in New Issue