From 1fbc8ef1ba119d8c04dbd18439453c2af3c9f761 Mon Sep 17 00:00:00 2001 From: s-egge Date: Sat, 29 Jun 2024 11:51:12 -0700 Subject: [PATCH] Added media check If the media fetch fails or there isn't any media in the folder, the main page won't set any timers/click listeners --- src/App.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index cf7db4c..6622f55 100644 --- a/src/App.vue +++ b/src/App.vue @@ -108,9 +108,6 @@ export default { this.$router.push('/') } }, - mounted () { - this.$el.addEventListener('click', this.navigateToHomepage) - }, async created () { // For future reference on how back button doesn't clear cache (for MU kiosk) // https://stackoverflow.com/a/75952012 @@ -124,11 +121,14 @@ export default { ) // setInterval expects milliseconds } - // create first timer - this.createInactivityTimer() - // get media for rotation await this.fetchMedia() + + // if there is media, create a timer and click listener for media rotation + if (this.mediaList.length > 0) { + this.$el.addEventListener('click', this.navigateToHomepage) + this.createInactivityTimer() + } }, beforeDestroy () { clearInterval(this.timer)