File tree Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
1
import EventService from '@/services/EventService.js'
2
2
3
+ export const namespaced = true
4
+
3
5
export const state = {
4
6
events : [ ] ,
5
7
eventsTotal : 0 ,
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ export default {
65
65
methods: {
66
66
createEvent () {
67
67
this .$store
68
- .dispatch (' createEvent' , this .event )
68
+ .dispatch (' event/ createEvent' , this .event )
69
69
.then (() => {
70
70
this .$router .push ({
71
71
name: ' event-show' ,
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export default {
24
24
this .perPage = 3 // Setting perPage here and not in data means it won't be reactive.
25
25
// We don't need it to be reactive, and this way our component has access to it.
26
26
27
- this .$store .dispatch (' fetchEvents' , {
27
+ this .$store .dispatch (' event/ fetchEvents' , {
28
28
perPage: this .perPage ,
29
29
page: this .page
30
30
})
Original file line number Diff line number Diff line change 25
25
</div >
26
26
</template >
27
27
<script >
28
- import { mapState } from ' vuex'
28
+ import { mapState , mapActions } from ' vuex'
29
29
30
30
export default {
31
31
props: [' id' ],
32
32
created () {
33
- this .$store . dispatch ( ' fetchEvent' , this .id )
33
+ this .fetchEvent ( this .id )
34
34
},
35
35
computed: mapState ({
36
36
event : state => state .event .event
37
- })
37
+ }),
38
+ methods: mapActions (' event' , [' fetchEvent' ])
38
39
}
39
40
</script >
40
41
<style scoped>
You can’t perform that action at this time.
0 commit comments