Download routers according to user level

Good morning everyone,

I would like to understand if it was possible to download the routers after login so as not to be able to access the pages unless authorized.
I tried other systems (such as downloading the menu only inherent to the user level), the problem that using the local modification of the file can always bypass the check, so there is a way to download the necessary routers after login so as not to have way to enter unauthorized pages?

here is how to add dynamic routes => eloquent-haslett-knrrby - CodeSandbox

but, if you really want to resolve your-issue,
then the only way is to let your server handle “who-can-see-what”.
never trust client-side (technically everything can be bypassed)

1 Like

I agree with you, but if the function must also go offline it is always better not to be able to select it a priori, then in the upload there will be user verification on the server side.

Can you update your codesandbox ?

here => wonderful-hill-ttqiy7 - CodeSandbox

1 Like

I need to learn something, for example, what update function do? Seems like a bit different of normal $update();

you can rewrite it to:

const update = (o) => {
  Object.assign(_,o);
  return $update();
};

or:

const update = (o) => {
  _.list = o.list;
  return $update();
};

they are all equivalent, i hope it’s clear.

Now that I look better at the links so they will always be online but correct not local? (they don’t work locally right?)

i don’t understand you question.
and i’m afraid that you taking the all security concern in the wrong direction

We are not only talking about security but about the architecture of the application itself, if I have three different users and each user must have a different menu, downloading the menu as in your example it seems that the page that loads it must download it every time is correct ? If it is correct it means that it cannot work offline

every time the user launch the app, yes.