-
-
Save nickmessing/f206056cb0eb8879b068f727a1aaecbb 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 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