File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,8 @@ import { WithWidth } from "@material-ui/core/withWidth";
5
5
import { makeStyles } from "@material-ui/styles" ;
6
6
import * as React from "react" ;
7
7
import { connect } from "react-redux" ;
8
- import { Route , RouteComponentProps , Router } from "react-router-dom" ;
8
+ import { Route , Router } from "react-router-dom" ;
9
9
// config
10
- import { history } from "./redux/configureStore" ;
11
10
import { RootState } from "./redux/rootReducer" ;
12
11
import withRoot from "./withRoot" ;
13
12
// hoc
@@ -28,7 +27,7 @@ function Routes() {
28
27
) ;
29
28
}
30
29
31
- interface Props extends RouteComponentProps < void > , WithWidth { }
30
+ interface Props extends WithWidth { }
32
31
33
32
function App ( props ?: Props ) {
34
33
const classes = useStyles ( ) ;
@@ -37,7 +36,7 @@ function App(props?: Props) {
37
36
}
38
37
39
38
return (
40
- < Router history = { history } >
39
+ < Router >
41
40
< div className = { classes . root } >
42
41
< div className = { classes . appFrame } >
43
42
< Routes />
Original file line number Diff line number Diff line change 1
1
import React , { useState , useEffect } from "react" ;
2
2
import { bindActionCreators } from "redux" ;
3
3
import { connect } from "react-redux" ;
4
- import { RouteComponentProps } from "react-router-dom" ;
5
4
6
5
// material ui
7
6
import Avatar from "@material-ui/core/Avatar" ;
@@ -20,6 +19,7 @@ import * as LoginActions from "../../redux/authentication/authenticationActions"
20
19
// elements
21
20
import FieldUsername from 'elements/FieldUsername/FieldUsername' ;
22
21
import FieldPassWord from 'elements/FieldPassword/FieldPassword' ;
22
+ import { useNavigate } from "react-router-dom" ;
23
23
24
24
const styles = ( theme : Theme ) => createStyles ( {
25
25
main : {
@@ -54,18 +54,19 @@ const styles = (theme: Theme) => createStyles({
54
54
} ) ;
55
55
56
56
57
- interface Props extends RouteComponentProps < any > {
57
+ interface Props {
58
58
classes : any ;
59
59
todoList : Todo [ ] ;
60
60
actions : typeof LoginActions ;
61
61
token : string | null ;
62
62
}
63
63
64
64
function Login ( props : Props ) {
65
- console . log ( props ) ;
66
65
const { classes } = props ;
67
66
const [ username , setUsername ] = useState ( "" ) ;
68
67
const [ password , setPassword ] = useState ( "" ) ;
68
+ const navigate = useNavigate ( ) ;
69
+
69
70
70
71
const handleSubmit = ( event : any ) => {
71
72
event . preventDefault ( ) ;
@@ -76,7 +77,7 @@ function Login(props: Props) {
76
77
} ;
77
78
useEffect ( ( ) => {
78
79
if ( props . token ) {
79
- props . history . push ( '/listing' ) ;
80
+ navigate ( '/listing' ) ;
80
81
}
81
82
} ) ;
82
83
return (
You can’t perform that action at this time.
0 commit comments