Fix vehicles details page + pass test

This commit is contained in:
2020-12-21 22:59:09 +01:00
parent 16a0dc47da
commit add48e09a8
2 changed files with 27 additions and 6 deletions

View File

@@ -5,7 +5,7 @@
</template>
<script>
import { mapState } from "vuex";
import { mapGetters } from "vuex";
export default {
name: "Vehicle",
@@ -21,10 +21,13 @@ export default {
return uuid.test(params.id);
},
async asyncData({ params, store }) {
await store.dispatch("getVehicle", params.id);
if (!store.state.vehicles.vehicle.id !== params.id)
await store.dispatch("vehicles/getVehicle", params.id);
},
computed: {
...mapState(["vehicle"])
...mapGetters({
vehicle: "vehicles/vehicle"
})
}
};
</script>