Skip to content

Instantly share code, notes, and snippets.

@nickmessing
Last active April 22, 2018 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickmessing/f206056cb0eb8879b068f727a1aaecbb to your computer and use it in GitHub Desktop.
Save nickmessing/f206056cb0eb8879b068f727a1aaecbb to your computer and use it in GitHub Desktop.
import Vue from 'vue'
import { Component } from 'vue-property-decorator'
import { namespace, Action, Getter } from 'vuex-class'
import { ActionGet, ActionCreate, ActionPatch, GetterList } from 'feathers-vuex'
interface Person { // should be identical to the model
firstName: string
lastName: string
}
const PeopleAction = namespace('people', Action)
const PeopleGetter = namespace('people', Getter)
@Component
export default class CreateEditPeople extends Vue {
@PeopleGetter('list') people: GetterList<Person>
@PeopleAction('get') getPerson: ActionGet<Person>
@PeopleAction('create') createPerson: ActionCreate<Person>
@PeopleAction('patch') patchPerson: ActionPatch<Person>
// people can use this.list or this.createPerson() fully typed here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment