File tree Expand file tree Collapse file tree 2 files changed +9
-17
lines changed
Expand file tree Collapse file tree 2 files changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -11,18 +11,17 @@ import {OrganizationStore} from 'sentry/stores/organizationStore';
1111import { ProjectsStore } from 'sentry/stores/projectsStore' ;
1212import { TeamStore } from 'sentry/stores/teamStore' ;
1313import type { Organization } from 'sentry/types/organization' ;
14- import { browserHistory } from 'sentry/utils/browserHistory' ;
1514import { normalizeUrl } from 'sentry/utils/url/normalizeUrl' ;
1615
1716type RedirectRemainingOrganizationParams = {
1817 /**
19- * The organization slug
18+ * navigate function from useNavigate
2019 */
21- orgId : string ;
20+ navigate : NavigateFunction ;
2221 /**
23- * navigate function from useNavigate
22+ * The organization slug
2423 */
25- navigate ?: NavigateFunction ;
24+ orgId : string ;
2625 /**
2726 * Should remove org?
2827 */
@@ -45,12 +44,7 @@ export function redirectToRemainingOrganization({
4544 org => org . status . id === 'active' && org . slug !== orgId
4645 ) ;
4746 if ( ! allOrgs . length ) {
48- if ( navigate ) {
49- navigate ( '/organizations/new/' ) ;
50- } else {
51- browserHistory . push ( '/organizations/new/' ) ;
52- }
53-
47+ navigate ( '/organizations/new/' ) ;
5448 return ;
5549 }
5650
@@ -64,11 +58,7 @@ export function redirectToRemainingOrganization({
6458 return ;
6559 }
6660
67- if ( navigate ) {
68- navigate ( route ) ;
69- } else {
70- browserHistory . push ( route ) ;
71- }
61+ navigate ( route ) ;
7262
7363 // Remove org from SidebarDropdown
7464 if ( removeOrg ) {
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import type {Organization} from 'sentry/types/organization';
1616import { getApiUrl } from 'sentry/utils/api/getApiUrl' ;
1717import { useApiQuery , useMutation } from 'sentry/utils/queryClient' ;
1818import { useApi } from 'sentry/utils/useApi' ;
19+ import { useNavigate } from 'sentry/utils/useNavigate' ;
1920import { useParams } from 'sentry/utils/useParams' ;
2021import { OrganizationDropdown } from 'sentry/views/navigation/primary/organizationDropdown' ;
2122import { UserDropdown } from 'sentry/views/navigation/primary/userDropdown' ;
@@ -32,6 +33,7 @@ type Props = {
3233
3334function DisabledMemberView ( props : Props ) {
3435 const { orgId} = useParams < { orgId : string } > ( ) ;
36+ const navigate = useNavigate ( ) ;
3537 const api = useApi ( { persistInFlight : true } ) ;
3638 const [ requested , setRequested ] = useState ( false ) ;
3739
@@ -95,7 +97,7 @@ function DisabledMemberView(props: Props) {
9597 organization : organization ! ,
9698 subscription,
9799 } ) ;
98- redirectToRemainingOrganization ( { orgId, removeOrg : true } ) ;
100+ redirectToRemainingOrganization ( { navigate , orgId, removeOrg : true } ) ;
99101 } ,
100102 onError : ( ) => {
101103 addErrorMessage ( t ( 'Unable to leave organization' ) ) ;
You can’t perform that action at this time.
0 commit comments