No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Services and Axios plugin

    Help
    2
    3
    1596
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      krugeros last edited by

      Hi,
      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:
      http://quasar-framework.org/guide/app-plugins.html

      Should I create another plugin called productsService.vue inside quasar plugins directory? How to reference the axios plugin with productsService plugin ?

      Any suggestions?

      1 Reply Last reply Reply Quote 1
      • benoitranque
        benoitranque last edited by

        What is this productsService plugin you speak of?

        No, you should not have any .vue files 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 Vue.prototype.$axios

        1 Reply Last reply Reply Quote 0
        • K
          krugeros last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post