-
-
Save championswimmer/378ebfa813c772692cf5613ce0a24e68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Module, VuexModule, MutationAction} from 'vuex-module-decorators' | |
import {ConferencesEntity, EventsEntity} from '@/models/definitions' | |
@Module | |
export default class HGAPIModule extends VuexModule { | |
conferences: Array<ConferencesEntity> = [] | |
events: Array<EventsEntity> = [] | |
// 'events' and 'conferences' are replaced by returned object | |
// whose shape must be `{events: {...}, conferences: {...} }` | |
@MutationAction({mutate: ['events', 'conferences']}) | |
async fetchAll () { | |
const response: Response = await getJSON('https://hasgeek.github.io/events/api/events.json') | |
return response | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment