npm i axios @damilaredev/vue-axios --save
import Vue from 'vue';
import VueAxios from '@damilaredev/vue-axios';
Vue.use(VueAxios);
<script>
export default {
computed: {
headers() {
return {
Authorization: `************************`,
};
},
},
methods: {
getItem: function () {
this.$get({
url: `your-url`,
headers: this.headers,
success: (response) => console.log(response),
error: (error) => console.log(error),
});
},
submitItem: function () {
this.$post({
url: `your-url`,
headers: this.headers,
data: { ...data },
success: (response) => console.log(response),
error: (error) => console.log(error),
});
},
deleteItem: function (id) {
this.$_delete({
url: `your-url/${id}`,
success: (response) => console.log(response),
error: (error) => console.log(error),
});
},
},
};
</script>
- Fork it!
- Create your feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -am 'Some commit message'
- Push to the branch:
git push origin feature-name
- Submit a pull request ๐๐
Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or Any Social Media? Spread the word!
Don't forget to follow me on twitter!
Thanks! Damilare.
This project is licensed under the MIT License - see the LICENSE.md file for details