Skip to content

Commit 48ba52f

Browse files
authored
fix(hybrid-cloud): Fix redirect on org removal for customer domains (#45220)
1 parent 71f76ef commit 48ba52f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

static/app/actionCreators/organizations.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import {browserHistory} from 'react-router';
33
import {addErrorMessage, addSuccessMessage} from 'sentry/actionCreators/indicator';
44
import {resetPageFilters} from 'sentry/actionCreators/pageFilters';
55
import {Client} from 'sentry/api';
6+
import {usingCustomerDomain} from 'sentry/constants';
67
import GuideStore from 'sentry/stores/guideStore';
78
import LatestContextStore from 'sentry/stores/latestContextStore';
89
import OrganizationsStore from 'sentry/stores/organizationsStore';
910
import OrganizationStore from 'sentry/stores/organizationStore';
1011
import ProjectsStore from 'sentry/stores/projectsStore';
1112
import TeamStore from 'sentry/stores/teamStore';
1213
import {Organization} from 'sentry/types';
14+
import {normalizeUrl} from 'sentry/utils/withDomainRequired';
1315

1416
type 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

Comments
 (0)