Skip to content

Commit e4ecc09

Browse files
committed
NameSpace Event
1 parent b03021d commit e4ecc09

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

src/store/modules/event.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import EventService from '@/services/EventService.js'
22

3+
export const namespaced = true
4+
35
export const state = {
46
events: [],
57
eventsTotal: 0,

src/views/EventCreate.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default {
6565
methods: {
6666
createEvent() {
6767
this.$store
68-
.dispatch('createEvent', this.event)
68+
.dispatch('event/createEvent', this.event)
6969
.then(() => {
7070
this.$router.push({
7171
name: 'event-show',

src/views/EventList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default {
2424
this.perPage = 3 // Setting perPage here and not in data means it won't be reactive.
2525
// We don't need it to be reactive, and this way our component has access to it.
2626
27-
this.$store.dispatch('fetchEvents', {
27+
this.$store.dispatch('event/fetchEvents', {
2828
perPage: this.perPage,
2929
page: this.page
3030
})

src/views/EventShow.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@
2525
</div>
2626
</template>
2727
<script>
28-
import { mapState } from 'vuex'
28+
import { mapState, mapActions } from 'vuex'
2929
3030
export default {
3131
props: ['id'],
3232
created() {
33-
this.$store.dispatch('fetchEvent', this.id)
33+
this.fetchEvent(this.id)
3434
},
3535
computed: mapState({
3636
event: state => state.event.event
37-
})
37+
}),
38+
methods: mapActions('event', ['fetchEvent'])
3839
}
3940
</script>
4041
<style scoped>

0 commit comments

Comments
 (0)