fix(theme-editor): fix enable invalid (#2539)
* fix(theme-editor): fix enable invalid * chore: fix typo
This commit is contained in:
parent
8e42da2b01
commit
176d380331
@ -9,7 +9,7 @@ export class ThemeEditorPlugin extends Plugin {
|
|||||||
beforeLoad() {}
|
beforeLoad() {}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
this.theme = this.db.collection({
|
this.db.collection({
|
||||||
name: 'themeConfig',
|
name: 'themeConfig',
|
||||||
fields: [
|
fields: [
|
||||||
// 主题配置内容,一个 JSON 字符串
|
// 主题配置内容,一个 JSON 字符串
|
||||||
@ -32,8 +32,14 @@ export class ThemeEditorPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async install(options?: InstallOptions) {
|
async install(options?: InstallOptions) {
|
||||||
if ((await this.theme.repository.count()) === 0) {
|
const themeRepo = this.db.getRepository('themeConfig');
|
||||||
await this.theme.repository.create({
|
|
||||||
|
if (!themeRepo) {
|
||||||
|
throw new Error(`themeConfig repository does not exist`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((await themeRepo.count()) === 0) {
|
||||||
|
await themeRepo.create({
|
||||||
values: [antd, dark, compact, compactDark],
|
values: [antd, dark, compact, compactDark],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user