/vuex-fn-api

Integration layer with vuex for API defined as functions (eg. Generated by Swagger)

Primary LanguageTypeScriptMIT LicenseMIT

vuex-fn-api

Installation

npm install @ilabo/vuex-fn-api
// store/modules/projects.js

import FnApi from "vuex-fn-api"
// Import api client
import client from '../api/client';

const projects = new FnApi({
    state: {
      projects: []
    }
  })
  .add({
    request: ({ projectId } : any) => client.getProject(projectId);
    property: "project",
  })
  // Add more request definitions here ..
  .getStore()

export default projects;