Load components after config has been pulled

This commit is contained in:
aterox 2022-03-05 01:22:32 -05:00
parent aeec449dc7
commit 7c86d6085b
1 changed files with 8 additions and 6 deletions

View File

@ -3,8 +3,8 @@
<EditModeTopBanner v-if="isEditMode" /> <EditModeTopBanner v-if="isEditMode" />
<LoadingScreen :isLoading="isLoading" v-if="shouldShowSplash" /> <LoadingScreen :isLoading="isLoading" v-if="shouldShowSplash" />
<Header :pageInfo="pageInfo" /> <Header :pageInfo="pageInfo" />
<router-view /> <router-view v-if="!isFetching" />
<Footer :text="footerText" v-if="visibleComponents.footer" /> <Footer :text="footerText" v-if="visibleComponents.footer && !isFetching" />
</div> </div>
</template> </template>
<script> <script>
@ -33,6 +33,7 @@ export default {
data() { data() {
return { return {
isLoading: true, // Set to false after mount complete isLoading: true, // Set to false after mount complete
isFetching: true, // Set to false after the conf has been fetched
}; };
}, },
watch: { watch: {
@ -40,6 +41,9 @@ export default {
// When in edit mode, show confirmation dialog on page exit // When in edit mode, show confirmation dialog on page exit
window.onbeforeunload = isEditMode ? this.confirmExit : null; window.onbeforeunload = isEditMode ? this.confirmExit : null;
}, },
config() {
this.isFetching = false;
},
}, },
computed: { computed: {
/* If the user has specified custom text for footer - get it */ /* If the user has specified custom text for footer - get it */
@ -69,9 +73,6 @@ export default {
return this.$store.state.editMode; return this.$store.state.editMode;
}, },
}, },
created() {
this.$store.dispatch(Keys.INITIALIZE_CONFIG);
},
methods: { methods: {
/* Injects the users custom CSS as a style tag */ /* Injects the users custom CSS as a style tag */
injectCustomStyles(usersCss) { injectCustomStyles(usersCss) {
@ -135,7 +136,8 @@ export default {
}, },
}, },
/* Basic initialization tasks on app load */ /* Basic initialization tasks on app load */
mounted() { async mounted() {
await this.$store.dispatch(Keys.INITIALIZE_CONFIG); // Initialize config before moving on
this.applyLanguage(); // Apply users local language this.applyLanguage(); // Apply users local language
this.hideSplash(); // Hide the splash screen, if visible this.hideSplash(); // Hide the splash screen, if visible
if (this.appConfig.customCss) { // Inject users custom CSS, if present if (this.appConfig.customCss) { // Inject users custom CSS, if present