import { IMovie } from "@autoplex-api/request";
|
|
import { Action, Mutation } from "../../store";
|
|
import { defineComponent } from "vue";
|
|
|
|
export default defineComponent({
|
|
computed: {
|
|
storedMovies(): IMovie[] {
|
|
return this.$store.getters.movies(this.movies);
|
|
}
|
|
},
|
|
unmounted() {
|
|
if (this.movies.length > 0) {
|
|
this.$store.dispatch(Action.UpdateMovies, { newValue: [], oldValue: this.movies });
|
|
}
|
|
},
|
|
props: {
|
|
movies: {
|
|
default: <IMovie[]>[]
|
|
}
|
|
},
|
|
watch: {
|
|
movies(newValue, oldValue) {
|
|
this.$store.dispatch(Action.UpdateMovies, { newValue, oldValue });
|
|
}
|
|
}
|
|
})
|