|
@@ -4,7 +4,7 @@ import {addErrorMessage, addLoadingMessage} from 'sentry/actionCreators/indicato
|
|
|
import {ModalRenderProps, openModal} from 'sentry/actionCreators/modal';
|
|
|
import {Alert} from 'sentry/components/alert';
|
|
|
import {Button} from 'sentry/components/button';
|
|
|
-import Confirm from 'sentry/components/confirm';
|
|
|
+import HookOrDefault from 'sentry/components/hookOrDefault';
|
|
|
import {
|
|
|
Panel,
|
|
|
PanelAlert,
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
import {t, tct} from 'sentry/locale';
|
|
|
import {Organization} from 'sentry/types';
|
|
|
import AsyncView from 'sentry/views/asyncView';
|
|
|
+import {ConfirmAccountClose} from 'sentry/views/settings/account/confirmAccountClose';
|
|
|
import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
|
|
|
import TextBlock from 'sentry/views/settings/components/text/textBlock';
|
|
|
|
|
@@ -106,9 +107,15 @@ class AccountClose extends AsyncView<Props, State> {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- handleRemoveAccount = async () => {
|
|
|
+ get orgSlugsToRemove() {
|
|
|
const {orgsToRemove} = this.state;
|
|
|
- const orgs = orgsToRemove === null ? this.singleOwnerOrgs : Array.from(orgsToRemove);
|
|
|
+ return (
|
|
|
+ (orgsToRemove === null ? this.singleOwnerOrgs : Array.from(orgsToRemove)) || []
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ handleRemoveAccount = async () => {
|
|
|
+ const orgs = this.orgSlugsToRemove;
|
|
|
|
|
|
addLoadingMessage('Closing account\u2026');
|
|
|
|
|
@@ -133,6 +140,11 @@ class AccountClose extends AsyncView<Props, State> {
|
|
|
renderBody() {
|
|
|
const {organizations, orgsToRemove} = this.state;
|
|
|
|
|
|
+ const HookedCustomConfirmAccountClose = HookOrDefault({
|
|
|
+ hookName: 'component:confirm-account-close',
|
|
|
+ defaultComponent: props => <ConfirmAccountClose {...props} />,
|
|
|
+ });
|
|
|
+
|
|
|
return (
|
|
|
<div>
|
|
|
<SettingsPageHeader title="Close Account" />
|
|
@@ -183,16 +195,10 @@ class AccountClose extends AsyncView<Props, State> {
|
|
|
))}
|
|
|
</PanelBody>
|
|
|
</Panel>
|
|
|
-
|
|
|
- <Confirm
|
|
|
- priority="danger"
|
|
|
- message={t(
|
|
|
- 'This is permanent and cannot be undone, are you really sure you want to do this?'
|
|
|
- )}
|
|
|
- onConfirm={this.handleRemoveAccount}
|
|
|
- >
|
|
|
- <Button priority="danger">{t('Close Account')}</Button>
|
|
|
- </Confirm>
|
|
|
+ <HookedCustomConfirmAccountClose
|
|
|
+ handleRemoveAccount={this.handleRemoveAccount}
|
|
|
+ organizationSlugs={this.orgSlugsToRemove}
|
|
|
+ />
|
|
|
</div>
|
|
|
);
|
|
|
}
|