should show the list of sprinkler.
This commit is contained in:
@@ -31,3 +31,6 @@ export default {
|
||||
a suivre !!!!=>
|
||||
|
||||
https://appdividend.com/2018/05/08/vuex-axios-get-request-tutorial-with-example/
|
||||
|
||||
example 2
|
||||
https://github.com/vuejs/vuex/blob/dev/examples/shopping-cart/components/ProductList.vue
|
||||
@@ -33,13 +33,14 @@ import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'PageSprinklers',
|
||||
mounted () {
|
||||
console.log('mounted')
|
||||
computed: mapState({
|
||||
sprinklers: state => state.sprinklers.all
|
||||
}),
|
||||
created () {
|
||||
console.log('created')
|
||||
this.$store.dispatch('sprinklers/load')
|
||||
},
|
||||
computed: mapState([
|
||||
'sprinklers'
|
||||
])
|
||||
console.log('sprin', this.sprinklers)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import api from '../../api/domo'
|
||||
// initial state
|
||||
// shape: [{ id, quantity }]
|
||||
const state = {
|
||||
sprinklers: []
|
||||
all: []
|
||||
}
|
||||
|
||||
// getters
|
||||
@@ -38,16 +38,6 @@ const actions = {
|
||||
})
|
||||
}
|
||||
}
|
||||
/*
|
||||
axios
|
||||
.get('http://localhost:4000/results')
|
||||
.then(r => r.data)
|
||||
.then(coins => {
|
||||
commit('SET_COINS', coins)
|
||||
})
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
checkout ({ commit, state }, products) {
|
||||
@@ -85,7 +75,7 @@ const actions = {
|
||||
const mutations = {
|
||||
SET_SPRINKLERS (state, sprinklers) {
|
||||
console.log('sprinkler', sprinklers)
|
||||
state.sprinklers = sprinklers
|
||||
state.all = sprinklers
|
||||
}
|
||||
/*
|
||||
pushProductToCart (state, { id }) {
|
||||
|
||||
Reference in New Issue
Block a user