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

@@ -4,5 +4,9 @@ export default {
getFruits: async ({ commit }) => {
const response = await axios.get("http://localhost:3000/fruit");
commit("setFruits", response.data.data);
},
getFruit: async ({ commit }, id) => {
const response = await axios.get(`http://localhost:3000/fruit/${id}`);
commit("setFruit", response.data);
}
};