colthreepv / colthreepv/angular-login-example

Can I store the userRole in the localStorage?

Open
#23 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
517
Forks
166
PR merge metrics
No merged PRs in 30d

Description

First, thank you for your example! I learned a lot from it :)

Now, I have a question, can I store the userRole in the localStorage?
In this example, when the user requested a $state, the loginService will do the getLoginData() function, if there is a token in the localStorage, the loginService will not init the userRole ,so the pendingStateChange will be inited. Which cause the the grandfather do the resolve to retrieve the userRole remotely.

So if I init the userRole to be public and store it in the localStorage, when user do some login action, I change the value of userRole in the localStorage. By this way, can I delete the resolve in the grandfather?Will it be unsafe if I delete the resolve?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.