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:
Tom Russell 2022-02-02 15:06:57 +00:00
parent 593e3a1f26
commit 4e40b31bac

View File

@ -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) {