1
- import PropTypes from 'prop-types' ;
2
1
import React from 'react' ;
3
2
import { useDispatch , useSelector } from 'react-redux' ;
4
3
import { Tab , Tabs , TabList , TabPanel } from 'react-tabs' ;
5
4
import { Helmet } from 'react-helmet' ;
6
5
import { useTranslation } from 'react-i18next' ;
7
- import { withRouter } from 'react-router-dom' ;
6
+ import { useHistory , useLocation } from 'react-router-dom' ;
8
7
import { parse } from 'query-string' ;
9
8
import { createApiKey , removeApiKey } from '../actions' ;
10
9
import AccountForm from '../components/AccountForm' ;
11
10
import SocialAuthButton from '../components/SocialAuthButton' ;
12
11
import APIKeyForm from '../components/APIKeyForm' ;
13
- import browserHistory from '../../../browserHistory' ;
14
12
import Nav from '../../../components/Nav' ;
15
13
import ErrorModal from '../../IDE/components/ErrorModal' ;
16
14
import Overlay from '../../App/components/Overlay' ;
@@ -45,16 +43,18 @@ function SocialLoginPanel() {
45
43
) ;
46
44
}
47
45
48
- function AccountView ( { location } ) {
46
+ function AccountView ( ) {
49
47
const { t } = useTranslation ( ) ;
50
48
49
+ const location = useLocation ( ) ;
51
50
const queryParams = parse ( location . search ) ;
52
51
const showError = ! ! queryParams . error ;
53
52
const errorType = queryParams . error ;
54
53
const accessTokensUIEnabled = window . process . env . UI_ACCESS_TOKEN_ENABLED ;
55
54
56
55
const apiKeys = useSelector ( ( state ) => state . user . apiKeys ) ;
57
56
const dispatch = useDispatch ( ) ;
57
+ const history = useHistory ( ) ;
58
58
59
59
return (
60
60
< div className = "account-settings__container" >
@@ -70,7 +70,7 @@ function AccountView({ location }) {
70
70
title = { t ( 'ErrorModal.LinkTitle' ) }
71
71
ariaLabel = { t ( 'ErrorModal.LinkTitle' ) }
72
72
closeOverlay = { ( ) => {
73
- browserHistory . push ( location . pathname ) ;
73
+ history . push ( location . pathname ) ;
74
74
} }
75
75
>
76
76
< ErrorModal type = "oauthError" service = { errorType } />
@@ -119,11 +119,4 @@ function AccountView({ location }) {
119
119
) ;
120
120
}
121
121
122
- AccountView . propTypes = {
123
- location : PropTypes . shape ( {
124
- search : PropTypes . string . isRequired ,
125
- pathname : PropTypes . string . isRequired
126
- } ) . isRequired
127
- } ;
128
-
129
- export default withRouter ( AccountView ) ;
122
+ export default AccountView ;
0 commit comments