Load Locations/People/Vehicles from layout on app load
This commit is contained in:
@@ -10,7 +10,16 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
middleware: ["redirect"]
|
||||
middleware: ["redirect"],
|
||||
fetchOnServer: false,
|
||||
async fetch() {
|
||||
const { store } = this.$nuxt.context;
|
||||
if (!store.state.people.list.length) await store.dispatch("people/getList");
|
||||
if (!store.state.vehicles.list.length)
|
||||
await store.dispatch("vehicles/getList");
|
||||
if (!store.state.locations.list.length)
|
||||
await store.dispatch("locations/getList");
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user