From 658a8ce4eee8b9c5d183895f9789969cf0dc60f0 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Wed, 1 Feb 2023 10:48:10 +0800 Subject: [PATCH] fix: theme page cannot be opened after the development environment is initialized (#833) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind bug #### What this PR does / why we need it: 修复在开发环境下首次初始化后,没有加载默认主题的情况下无法访问主题管理页面的问题。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/3187 #### Special notes for your reviewer: 测试方式: 1. 在开发环境使用全新的数据库初始化。 2. 检查是否能够正常的访问主题管理页面。 #### Does this PR introduce a user-facing change? ```release-note None ``` --- src/stores/theme.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stores/theme.ts b/src/stores/theme.ts index 301138f4..44e96232 100644 --- a/src/stores/theme.ts +++ b/src/stores/theme.ts @@ -19,7 +19,9 @@ export const useThemeStore = defineStore("theme", () => { mute: true, }); - activatedTheme.value = data; + if (data) { + activatedTheme.value = data; + } } catch (e) { console.error("Failed to fetch active theme", e); }