Create vuex modules for Films/Vehicles/Locations/People + Test adaptation
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
<script>
|
||||
import Grid from "@/components/Grid";
|
||||
import { mapState } from "vuex";
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "Films",
|
||||
@@ -20,10 +20,12 @@ export default {
|
||||
titleTemplate: "%s - Films"
|
||||
},
|
||||
async asyncData({ store }) {
|
||||
await store.dispatch("getFilms");
|
||||
if (!store.state.films.list.length) await store.dispatch("films/getList");
|
||||
},
|
||||
computed: {
|
||||
...mapState(["films"])
|
||||
...mapGetters({
|
||||
films: "films/list"
|
||||
})
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user