Skip to content

Commit

Permalink
NameSpace Event
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregg committed Oct 11, 2018
1 parent b03021d commit e4ecc09
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/store/modules/event.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import EventService from '@/services/EventService.js'

export const namespaced = true

export const state = {
events: [],
eventsTotal: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/views/EventCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default {
methods: {
createEvent() {
this.$store
.dispatch('createEvent', this.event)
.dispatch('event/createEvent', this.event)
.then(() => {
this.$router.push({
name: 'event-show',
Expand Down
2 changes: 1 addition & 1 deletion src/views/EventList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
this.perPage = 3 // Setting perPage here and not in data means it won't be reactive.
// We don't need it to be reactive, and this way our component has access to it.
this.$store.dispatch('fetchEvents', {
this.$store.dispatch('event/fetchEvents', {
perPage: this.perPage,
page: this.page
})
Expand Down
7 changes: 4 additions & 3 deletions src/views/EventShow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@
</div>
</template>
<script>
import { mapState } from 'vuex'
import { mapState, mapActions } from 'vuex'
export default {
props: ['id'],
created() {
this.$store.dispatch('fetchEvent', this.id)
this.fetchEvent(this.id)
},
computed: mapState({
event: state => state.event.event
})
}),
methods: mapActions('event', ['fetchEvent'])
}
</script>
<style scoped>
Expand Down

0 comments on commit e4ecc09

Please sign in to comment.