@microservice-framework/vue-api-client

1.0.1 • Public • Published

vue-api-client

Vue.$api that is capable to be watched and provide wrapper to access MFW API

usage

import APICLient from "@microservice-framework/vue-api-client";

// Init global this.$state variable
Vue.use(APICLient, {
  apiURL: "https://api.myserver.com",
  methods: [
    {
      name: "printSelf",
      function: function () {
        console.log(this);
      },
    }
  ]
});

....


this.$api.setAccessToken({
        accessToken: "APIAccessToken",
        expireAt: -1,
      });

...

watch: {
  '$api.online': function(newValue) {
    if(newValue) {
      //fetch data from API
    }
  }
}

Readme

Keywords

Package Sidebar

Install

npm i @microservice-framework/vue-api-client

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

4.66 kB

Total Files

4

Last publish

Collaborators

  • microservice-framework