Skip to main content

Private Routing

What Is this?

Crono uses react-router to manage the routing of the application.
You can access each route by entering the right URL in the url bar of your browser.

info

The call to the getRefreshToken function, will also manage a non authenticated user

Since Matchplat applications are closed to public access by using private tokens, it was necessary to create a component that controls direct access to each route of the application.

Install

Install PrivateRoute into your components for manage Routes:

import { PrivateRoute } from "@matchplat/crono";

Use this to load your components into the <Router> like this:

const ComponentToLoad = React.lazy(() => import("./componentToLoad"));

const Route = () => {
return (
<Router>
<Switch>
<PrivateRoute exact path="/" component={ComponentToLoad} />
</Switch>
</Router>
);
};