Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions static/app/actionCreators/organizations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import {browserHistory} from 'react-router';
import {addErrorMessage, addSuccessMessage} from 'sentry/actionCreators/indicator';
import {resetPageFilters} from 'sentry/actionCreators/pageFilters';
import {Client} from 'sentry/api';
import {usingCustomerDomain} from 'sentry/constants';
import GuideStore from 'sentry/stores/guideStore';
import LatestContextStore from 'sentry/stores/latestContextStore';
import OrganizationsStore from 'sentry/stores/organizationsStore';
import OrganizationStore from 'sentry/stores/organizationStore';
import ProjectsStore from 'sentry/stores/projectsStore';
import TeamStore from 'sentry/stores/teamStore';
import {Organization} from 'sentry/types';
import {normalizeUrl} from 'sentry/utils/withDomainRequired';

type RedirectRemainingOrganizationParams = {
/**
Expand Down Expand Up @@ -44,9 +46,15 @@ export function redirectToRemainingOrganization({

// Let's be smart and select the best org to redirect to
const firstRemainingOrg = allOrgs[0];
// TODO(domains) Need to find a good way to handle this. useResolveRoute()
// doesn't currently work because it is a hook.
browserHistory.push(`/organizations/${firstRemainingOrg.slug}/issues/`);

const route = `/organizations/${firstRemainingOrg.slug}/issues/`;
if (usingCustomerDomain) {
const {organizationUrl} = firstRemainingOrg.links;
window.location.assign(`${organizationUrl}${normalizeUrl(route)}`);
return;
}

browserHistory.push(route);

// Remove org from SidebarDropdown
if (removeOrg) {
Expand Down