@@ -3,13 +3,15 @@ import {browserHistory} from 'react-router';
33import { addErrorMessage , addSuccessMessage } from 'sentry/actionCreators/indicator' ;
44import { resetPageFilters } from 'sentry/actionCreators/pageFilters' ;
55import { Client } from 'sentry/api' ;
6+ import { usingCustomerDomain } from 'sentry/constants' ;
67import GuideStore from 'sentry/stores/guideStore' ;
78import LatestContextStore from 'sentry/stores/latestContextStore' ;
89import OrganizationsStore from 'sentry/stores/organizationsStore' ;
910import OrganizationStore from 'sentry/stores/organizationStore' ;
1011import ProjectsStore from 'sentry/stores/projectsStore' ;
1112import TeamStore from 'sentry/stores/teamStore' ;
1213import { Organization } from 'sentry/types' ;
14+ import { normalizeUrl } from 'sentry/utils/withDomainRequired' ;
1315
1416type RedirectRemainingOrganizationParams = {
1517 /**
@@ -44,9 +46,15 @@ export function redirectToRemainingOrganization({
4446
4547 // Let's be smart and select the best org to redirect to
4648 const firstRemainingOrg = allOrgs [ 0 ] ;
47- // TODO(domains) Need to find a good way to handle this. useResolveRoute()
48- // doesn't currently work because it is a hook.
49- browserHistory . push ( `/organizations/${ firstRemainingOrg . slug } /issues/` ) ;
49+
50+ const route = `/organizations/${ firstRemainingOrg . slug } /issues/` ;
51+ if ( usingCustomerDomain ) {
52+ const { organizationUrl} = firstRemainingOrg . links ;
53+ window . location . assign ( `${ organizationUrl } ${ normalizeUrl ( route ) } ` ) ;
54+ return ;
55+ }
56+
57+ browserHistory . push ( route ) ;
5058
5159 // Remove org from SidebarDropdown
5260 if ( removeOrg ) {
0 commit comments