Browse Source

ref(js): Convert OrganizationCreate to a FC (#30638)

Evan Purkhiser 3 years ago
parent
commit
cf0eba6759
1 changed files with 15 additions and 23 deletions
  1. 15 23
      static/app/views/organizationCreate.tsx

+ 15 - 23
static/app/views/organizationCreate.tsx

@@ -1,29 +1,15 @@
 import NarrowLayout from 'sentry/components/narrowLayout';
+import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
 import {t, tct} from 'sentry/locale';
 import ConfigStore from 'sentry/stores/configStore';
-import AsyncView from 'sentry/views/asyncView';
 import {ApiForm, CheckboxField, TextField} from 'sentry/views/settings/components/forms';
 
-export default class OrganizationCreate extends AsyncView {
-  onSubmitSuccess = data => {
-    // redirect to project creation *(BYPASS REACT ROUTER AND FORCE PAGE REFRESH TO GRAB CSRF TOKEN)*
-    // browserHistory.pushState(null, `/organizations/${data.slug}/projects/new/`);
-    window.location.href = `/organizations/${data.slug}/projects/new/`;
-  };
+function OrganizationCreate() {
+  const termsUrl = ConfigStore.get('termsUrl');
+  const privacyUrl = ConfigStore.get('privacyUrl');
 
-  getEndpoints(): ReturnType<AsyncView['getEndpoints']> {
-    return [];
-  }
-
-  getTitle() {
-    return t('Create Organization');
-  }
-
-  renderBody() {
-    const termsUrl = ConfigStore.get('termsUrl');
-    const privacyUrl = ConfigStore.get('privacyUrl');
-
-    return (
+  return (
+    <SentryDocumentTitle title={t('Create Organization')}>
       <NarrowLayout showLogout>
         <h3>{t('Create a New Organization')}</h3>
 
@@ -38,7 +24,11 @@ export default class OrganizationCreate extends AsyncView {
           submitLabel={t('Create Organization')}
           apiEndpoint="/organizations/"
           apiMethod="POST"
-          onSubmitSuccess={this.onSubmitSuccess}
+          onSubmitSuccess={data => {
+            // redirect to project creation *(BYPASS REACT ROUTER AND FORCE PAGE REFRESH TO GRAB CSRF TOKEN)*
+            // browserHistory.pushState(null, `/organizations/${data.slug}/projects/new/`);
+            window.location.href = `/organizations/${data.slug}/projects/new/`;
+          }}
           requireChanges
         >
           <TextField
@@ -70,6 +60,8 @@ export default class OrganizationCreate extends AsyncView {
           )}
         </ApiForm>
       </NarrowLayout>
-    );
-  }
+    </SentryDocumentTitle>
+  );
 }
+
+export default OrganizationCreate;