I have to redirect to the /user/dashboard page after login, but every time I close the tab and open it again it is opening the default home page i.e /.
import React from 'react';
import {isAuthenticated} from '../helpers/auth'
import {Route, Redirect } from 'react-router-dom';
const UserRoute = ({component: Component, ...rest}) => {
return(
<Route
{...rest}
render={(props)=>
isAuthenticated() && isAuthenticated().role === 0 ? (
<Component {...props} />
):(
<Redirect to="/signin" />
)
}
/>
);
}
export default UserRoute;