Skip to content

Latest commit

 

History

History
35 lines (28 loc) · 938 Bytes

README.md

File metadata and controls

35 lines (28 loc) · 938 Bytes

@reststate/vuex

@reststate/vuex allows you to access data from a JSON:API web service via Vuex stores. Because of JSON:API's strong conventions, in most cases all you should need to do is tell @reststate/vuex the base URL of your web service, and which resources to access, and you should be set. No manual web request juggling!

This is a very early proof-of-concept, so many features of JSON:API are not yet supported. Open a GitHub issue with any other features you'd like to see!

Synopsis

const store = new Vuex.Store({
  modules: {
    'widgets': resourceModule({
      name: 'widgets',
      httpClient: axios.create(...),
    }),
  },
});

const component = {
  methods: {
    ...mapActions({
      loadAllWidgets: 'widgets/loadAll',
    }),
  },
  computed: {
    ...mapGetters({
      widgets: 'widgets/all',
    }),
  },
};

License

Apache 2.0