Fix for compilation error
ERROR in src/frontend/route.tsx:36:25 TS2339: Property 'from' does not exist on type '{}'.
This commit is contained in:
parent
593e3a1f26
commit
4e40b31bac
@ -33,7 +33,12 @@ export const AuthRoute: React.FC<RouteProps> = ({ component: Component, children
|
|||||||
{...rest}
|
{...rest}
|
||||||
render={props => {
|
render={props => {
|
||||||
if(isAuthenticated) {
|
if(isAuthenticated) {
|
||||||
const { from } = props.location.state ?? { from: '/my-account.html'};
|
let state = props.location.state as any;
|
||||||
|
let from = '/my-account.html';
|
||||||
|
if ('from' in state){
|
||||||
|
from = state.from;
|
||||||
|
}
|
||||||
|
|
||||||
return <Redirect to={{pathname: from }} />;
|
return <Redirect to={{pathname: from }} />;
|
||||||
} else {
|
} else {
|
||||||
if(Component) {
|
if(Component) {
|
||||||
|
Loading…
Reference in New Issue
Block a user