From 7cd884ad92fb063422dd4ac4d7c27615e731e984 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 1 Mar 2022 19:07:42 +0100 Subject: [PATCH] load theme list in site-form.tsx --- src/shared/components/home/site-form.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/shared/components/home/site-form.tsx b/src/shared/components/home/site-form.tsx index 09bf66ec..59db4551 100644 --- a/src/shared/components/home/site-form.tsx +++ b/src/shared/components/home/site-form.tsx @@ -6,7 +6,7 @@ import { WebSocketService } from "../../services"; import { authField, capitalizeFirstLetter, - themes, + fetchThemeList, wsClient, } from "../../utils"; import { Spinner } from "../common/icon"; @@ -21,6 +21,7 @@ interface SiteFormProps { interface SiteFormState { siteForm: EditSite; loading: boolean; + themeList: string[]; } export class SiteForm extends Component { @@ -40,6 +41,7 @@ export class SiteForm extends Component { auth: authField(), }, loading: false, + themeList: [], }; constructor(props: any, context: any) { @@ -78,6 +80,11 @@ export class SiteForm extends Component { } } + async componentDidMount() { + this.state.themeList = await fetchThemeList(); + this.setState(this.state); + } + // Necessary to stop the loading componentWillReceiveProps() { this.state.loading = false; @@ -336,7 +343,7 @@ export class SiteForm extends Component { class="custom-select w-auto" > - {themes.map(theme => ( + {this.state.themeList.map(theme => ( ))}