cinema/app.riot

53 lines
1.6 KiB
Plaintext
Raw Normal View History

2022-04-02 12:00:24 +02:00
<app>
<filters></filters>
<movie-container movieList="{state.currentMovieList.results}"></movie-container>
<script>
export default {
onBeforeMount(props, state) {
this.state = {
currentMovieList: [],
}
},
onMounted() {
this.updateMovieList();
console.log("helo")
console.log(this.state.currentMovieList.results)
},
async updateMovieList() {
console.log("updating")
switch(localStorage.getItem("currfilter")) {
case "popular":
console.log("loading popular")
this.update ({
currentMovieList : await movieUtils.getPopularMovies()
})
break
case "top_rated":
console.log("loading top_rated")
this.update ({
currentMovieList : await movieUtils.getTopRatedMovies()
})
break
case "coming_soon":
console.log("loading coming_soon")
this.update ({
currentMovieList : await movieUtils.getComingSoonMovies()
})
break
case "new":
console.log("loading new")
this.update ({
currentMovieList : await movieUtils.getNewMovies()
})
break
}
},
}
</script>
</app>