1.0.1 • Published 5 months ago

@microservice-framework/vue-api-client v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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
    }
  }
}