Well, I have appinions_

DIVIDE BY Z3R0

🍔

Are you authrised, dear sir??

Are you authrised, dear sir??

There is one thing that 100% of the projects i worked on had - Authorisation. Some sort of frontend authorisation is almost always nesesary if you are working in react, since most of projects are some services that include some sort of dashboard and set dashboard is locked behind username and password. So, how to handle userflow with login, logout, authorisation, what user can and cant see.

I will examine few different ways for each step, and i will utilise power of react router. I hate ineffiecency so lets get to the business.

What problem we have to solve?

Problem one - Is user logged in, and authorised to see the dashboard? If user is logged in he should see dashboard, if user is not logged in, he should see login page.

Problem two - When user logs out he should be redirected to login page.

Problem tree - if user is admin he should see all components, if its normal user - he should see only user components.

So lets roll up sleeves.

Latest posts:

• How to Escape the Frontend Medior Void?

• Would you rather be feared or loved?

• Are you authrised, dear sir??

• Happy healthy software developer

Share on: