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
    1. Home
    2. michael999
    M
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Groups 0

    michael999

    @michael999

    0
    Reputation
    168
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    michael999 Follow

    Latest posts made by michael999

    • RE: Use Plugin inside Vuex module action

      You can use this simple plugin https://github.com/imcvampire/vue-axios. (This wrapper bind axios to Vue or this if you’re using single file component)

      Then you can use axios like this :

      import Vue from 'vue'
      import { Notify, Loading } from 'quasar'
      /*
      export const someAction = (state) => {
      }
      */
      export const doLogin = (state,creds) => {
        state.commit('LOGIN')
        let email=creds.email
        let password=creds.password
        console.log(this.$axios)
        return Vue.axios
          .post('/auth/signin', {
            email,
            password
          })
          .then(r => {
            //console.log(r)
            //localStorage.setItem("token", "JWT");
            commit('LOGIN_SUCCESS')
            return r
          })
          .catch(e => {
            //console.log(e.response)
            Notify.create("Error: " + e.response.status)
            //localStorage.removeItem("token")
            commit('LOGOUT')
            return e
          })
      }
      
      export const doLogout = (state) => {
        localStorage.removeItem("token")
        commit(LOGOUT)
      }
      
      posted in Help
      M
      michael999