Skip to content

Commit

Permalink
Added media check
Browse files Browse the repository at this point in the history
If the media fetch fails or there isn't any media in the folder, the main page won't set any timers/click listeners
  • Loading branch information
s-egge committed Jun 29, 2024
1 parent 9fa8645 commit 1fbc8ef
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 1fbc8ef

Please sign in to comment.