should show the list of sprinkler.
This commit is contained in:
@@ -31,3 +31,6 @@ export default {
|
|||||||
a suivre !!!!=>
|
a suivre !!!!=>
|
||||||
|
|
||||||
https://appdividend.com/2018/05/08/vuex-axios-get-request-tutorial-with-example/
|
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 {
|
export default {
|
||||||
name: 'PageSprinklers',
|
name: 'PageSprinklers',
|
||||||
mounted () {
|
computed: mapState({
|
||||||
console.log('mounted')
|
sprinklers: state => state.sprinklers.all
|
||||||
|
}),
|
||||||
|
created () {
|
||||||
|
console.log('created')
|
||||||
this.$store.dispatch('sprinklers/load')
|
this.$store.dispatch('sprinklers/load')
|
||||||
},
|
console.log('sprin', this.sprinklers)
|
||||||
computed: mapState([
|
}
|
||||||
'sprinklers'
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import api from '../../api/domo'
|
|||||||
// initial state
|
// initial state
|
||||||
// shape: [{ id, quantity }]
|
// shape: [{ id, quantity }]
|
||||||
const state = {
|
const state = {
|
||||||
sprinklers: []
|
all: []
|
||||||
}
|
}
|
||||||
|
|
||||||
// getters
|
// 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) {
|
checkout ({ commit, state }, products) {
|
||||||
@@ -85,7 +75,7 @@ const actions = {
|
|||||||
const mutations = {
|
const mutations = {
|
||||||
SET_SPRINKLERS (state, sprinklers) {
|
SET_SPRINKLERS (state, sprinklers) {
|
||||||
console.log('sprinkler', sprinklers)
|
console.log('sprinkler', sprinklers)
|
||||||
state.sprinklers = sprinklers
|
state.all = sprinklers
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
pushProductToCart (state, { id }) {
|
pushProductToCart (state, { id }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user