How to implement a simple routing login interception in dva2.1+react route 4. 0

if you want to do a login block in a public route, some routes need to log in to enter. Which god has an idea, please provide it. Thank you

.

Let's get to the point of thinking that route4 is actually implemented in the form of components, so in fact each route is a separate component.

based on this, as long as there are two large parent components, one includes those that require permissions and the other does not (or at the top-level route includes a route that requires permission verification and other peer route, that do not need to verify, use Switch as the only correspondence).

you can jump to the login page as long as you determine whether the current user has permissions or not during the appropriate life cycle of the parent component that requires permissions.

Menu