Services and Axios plugin
I am trying to figure out how to build a services for my backend API using the axios plugin in quasar 0.15.
Quasar documentation contains an example of Axios plugin:
Should I create another plugin called productsService.vue inside quasar plugins directory? How to reference the axios plugin with productsService plugin ?
benoitranque last edited by
What is this
productsServiceplugin you speak of?
No, you should not have any
.vuefiles in the
src/plugins/directory. If you create new plugins make sure to use
quasar new plugin <plugin-name>so you get correct syntax
To access axios in a vue file simply use
this.$axios, if you kept the default axios plugin config. If you want to use it in another plugin that is loaded after axios, use
Ok. Of course my mistake - it should be productsService.js located in the src/plugins/ direfctory.
productsService.js is responsible for passing configuration to my productsService library which is responsible for GET, POST, DELETE calls to my store products API.
Thank you for your help. Your answer was realy helpful.