D
D
Dmitry Kuzmenko2020-01-29 22:55:56
Vue.js
Dmitry Kuzmenko, 2020-01-29 22:55:56

How to do Nuxt Auth Role Authentication?

Good day, please kick in the right direction, how to roughly implement authorization by nuxt roles, for learning purposes.
Now I have raised Laravel as a backend, I have screwed the authorization according to the guide through nuxt auth.
The principle is this, I get a token, write the token and all user data to the side, then when I go to another page, I again make a request to the backend and load the necessary information using the data from the side.

...mapActions('profile', ['apiProfileInfo'])

async apiProfileInfo({commit}) {
    await this.$axios.$get('user').then(response => {
      commit('setInfo', response.success) 
    })
  }


PS If I'm not doing the right thing in general, I'll be glad to hear any criticism.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question