Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authorized routes

See original GitHub issue

I’m not sure how to implement authorised routes. I need to check Redux state.users.viewer to enforce redirect with requested location. Does it belong to routeConfig or it should be a higher order component? Can we use <Redirect /> component in a view?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:34 (16 by maintainers)

github_iconTop GitHub Comments

taioncommented, Feb 15, 2017

Great, so the object you get as the argument to render has a match property, and you can use in render.

taioncommented, Feb 13, 2017

Sure, so either do:

throw new RedirectException({
    pathname: '/login',
    state: { previousLocation: location },

Or if you use the error handler approach, you get that for free (just do router.replace(location) afterward).

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Router 6: Private Routes (alias Protected Routes)
Private Routes in React Router (also called Protected Routes) require a user being authorized to visit a route (read: page).
Read more >
authorized route vs unauthorized routes reactjs not properly ...
I am having trouble understanding why my Authorized vs Unauthorized routes are not acting properly.. Here are the way my routes are set...
Read more >
Authorized routes - Deadbolt for Java
AuthorizedRoutes . This extended class defines the route constraints, and needs to be bound into the dependency injection context. Take a simple routes...
Read more >
Authorized Routes Definition | Law Insider
Authorized Routes means the Public Right-of-Way within the Town as set forth on the maps attached as Exhibit A, as such routes may...
Read more >
Protected Routes and Authentication with React Router -
In this up-to-date guide, you'll learn a pattern for adding protected routes to your React Router application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found