M
M
Meefril2021-09-21 15:27:28
Vue.js
Meefril, 2021-09-21 15:27:28

How to correctly draw elements depending on the role?

Hello, I would like to know how to correctly render elements that are available only, for example, to the editor. After authorization, the user receives a JWT containing his role. There is a personal account and the conditional editor has a field in the menu where you can add entries, and now I just do a v-show of this menu item if the user is an editor, but I doubt that this is the right approach ... How to solve this kind of tasks correctly ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2021-09-21
@Meefril

In this case, not v-show, but v-if is more correct.
And, of course, checking on the backend.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question