@@ -20,9 +20,8 @@ import {IconDelete} from 'sentry/icons';
20
20
import { t , tct } from 'sentry/locale' ;
21
21
import type { RouteComponentProps } from 'sentry/types/legacyReactRouter' ;
22
22
import type { Team } from 'sentry/types/organization' ;
23
- import { browserHistory } from 'sentry/utils/browserHistory' ;
24
- import normalizeUrl from 'sentry/utils/url/normalizeUrl' ;
25
23
import useApi from 'sentry/utils/useApi' ;
24
+ import { useNavigate } from 'sentry/utils/useNavigate' ;
26
25
import useOrganization from 'sentry/utils/useOrganization' ;
27
26
import PermissionAlert from 'sentry/views/settings/project/permissionAlert' ;
28
27
@@ -31,6 +30,7 @@ interface TeamSettingsProps extends RouteComponentProps<{teamId: string}, {}> {
31
30
}
32
31
33
32
function TeamSettings ( { team, params} : TeamSettingsProps ) {
33
+ const navigate = useNavigate ( ) ;
34
34
const organization = useOrganization ( ) ;
35
35
const api = useApi ( ) ;
36
36
@@ -40,16 +40,16 @@ function TeamSettings({team, params}: TeamSettingsProps) {
40
40
updateTeamSuccess ( team . slug , resp ) ;
41
41
if ( id === 'slug' ) {
42
42
addSuccessMessage ( t ( 'Team name changed' ) ) ;
43
- browserHistory . replace (
44
- normalizeUrl ( `/settings/ ${ organization . slug } /teams/ ${ resp . slug } /settings/` )
45
- ) ;
43
+ navigate ( `/settings/ ${ organization . slug } /teams/ ${ resp . slug } /settings/` , {
44
+ replace : true ,
45
+ } ) ;
46
46
}
47
47
} ;
48
48
49
49
const handleRemoveTeam = async ( ) => {
50
50
try {
51
51
await removeTeam ( api , { orgId : organization . slug , teamId : params . teamId } ) ;
52
- browserHistory . replace ( normalizeUrl ( `/settings/${ organization . slug } /teams/` ) ) ;
52
+ navigate ( `/settings/${ organization . slug } /teams/` , { replace : true } ) ;
53
53
} catch {
54
54
// removeTeam already displays an error message
55
55
}
0 commit comments