Setup routing for FruitDetails + fetch data on route transition + Fix fruit tests

This commit is contained in:
2020-12-04 03:25:59 +01:00
parent d2b7c4d93c
commit a62d07e97e
13 changed files with 581 additions and 79 deletions

View File

@@ -1,5 +1,23 @@
<template>
<div>
<h1>Fruit Details</h1>
{{ this.fruit }}
</div>
</template>
<script>
import { mapState } from "vuex";
export default {
name: "FruitDetails",
computed: {
...mapState(["fruit"])
},
beforeRouteEnter(to, from, next) {
next(async vm => {
await vm.$store.dispatch("getFruit", to.params.id);
});
}
};
</script>
<style></style>