Pass 'is logged on' info to frontend
See original GitHub issueOn BE req.isAuthenticated()
tells me if the user is logged in, but I need to propagate this information to frontend. I noticed there is an admin route:
src/routes/admin/index.js:
const isAdmin = false;
...
async action() {
if (!isAdmin) { // Redirect to login page if user is not admin
return { redirect: '/login' };
}
...
},
but as you can see, the isAdmin
bool is always set to false.
(I also need this info on FE to display logout button, etc)
Whats the best way to go about doing this?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How I could pass user data from back to frontend?
I made a YelpCamp clone ony with node and EJS but I'm trying to convert to a Node-React project and was working until...
Read more >Passing the User Id to the Frontend in MEAN Stack - Javatpoint
Passing the User Id to the Frontend in MEAN Stack · 1) We will go back to our js file, where we create...
Read more >Passing Data Between Frontend and Backend | Node.js
In this beginner tutorial, I run through frontend (client-side) to backend (server) communication. We look at all the different ways to send ...
Read more >Backend For Frontend Authentication Pattern with Auth0 and ...
The user can log in with their username and password, social provider, or any other identity provider. Once the user has logged in,...
Read more >Logging in Browser. Using a structured logger in your…
Logs must be serializable. Logs must be available in production. Given all of the above, what is the best way to log in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Jaikant why not, you may add actions/reducers to update any data in your store including user, it is up to you. User info presented in store here: (feature/redux branch) src/server.js#L94
@frenzzy any reason for not using a redux action/reducer to update the user information into the store? I guess because of this, the user information is not present on client redux store. Is this intentional and not needed?