1- import PropTypes from 'prop-types' ;
21import React from 'react' ;
32import { useDispatch , useSelector } from 'react-redux' ;
43import { Tab , Tabs , TabList , TabPanel } from 'react-tabs' ;
54import { Helmet } from 'react-helmet' ;
65import { useTranslation } from 'react-i18next' ;
7- import { withRouter } from 'react-router-dom' ;
6+ import { useHistory , useLocation } from 'react-router-dom' ;
87import { parse } from 'query-string' ;
98import { createApiKey , removeApiKey } from '../actions' ;
109import AccountForm from '../components/AccountForm' ;
1110import SocialAuthButton from '../components/SocialAuthButton' ;
1211import APIKeyForm from '../components/APIKeyForm' ;
13- import browserHistory from '../../../browserHistory' ;
1412import Nav from '../../../components/Nav' ;
1513import ErrorModal from '../../IDE/components/ErrorModal' ;
1614import Overlay from '../../App/components/Overlay' ;
@@ -45,16 +43,18 @@ function SocialLoginPanel() {
4543 ) ;
4644}
4745
48- function AccountView ( { location } ) {
46+ function AccountView ( ) {
4947 const { t } = useTranslation ( ) ;
5048
49+ const location = useLocation ( ) ;
5150 const queryParams = parse ( location . search ) ;
5251 const showError = ! ! queryParams . error ;
5352 const errorType = queryParams . error ;
5453 const accessTokensUIEnabled = window . process . env . UI_ACCESS_TOKEN_ENABLED ;
5554
5655 const apiKeys = useSelector ( ( state ) => state . user . apiKeys ) ;
5756 const dispatch = useDispatch ( ) ;
57+ const history = useHistory ( ) ;
5858
5959 return (
6060 < div className = "account-settings__container" >
@@ -70,7 +70,7 @@ function AccountView({ location }) {
7070 title = { t ( 'ErrorModal.LinkTitle' ) }
7171 ariaLabel = { t ( 'ErrorModal.LinkTitle' ) }
7272 closeOverlay = { ( ) => {
73- browserHistory . push ( location . pathname ) ;
73+ history . push ( location . pathname ) ;
7474 } }
7575 >
7676 < ErrorModal type = "oauthError" service = { errorType } />
@@ -119,11 +119,4 @@ function AccountView({ location }) {
119119 ) ;
120120}
121121
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