vue plugin to manage your requests
$ npm install --save maple-request
index.js:
import Vue from 'vue';
import MapleRequest from 'maple-request';
Vue.use(MapleRequest, {
apis: {
requestA: {
url: 'https://some-domain.com/api/requestA',
},
},
});
app.vue:
<template>
<div class="app"></div>
</temlate>
<script>
export default {
mounted(){
this.$request('requestA')
.then(response=> {})
.catch(error=> {})
}
}
</script>