teamCreate.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {withRouter, WithRouterProps} from 'react-router';
  2. import NarrowLayout from 'app/components/narrowLayout';
  3. import CreateTeamForm from 'app/components/teams/createTeamForm';
  4. import {t} from 'app/locale';
  5. import {Organization} from 'app/types';
  6. import withOrganization from 'app/utils/withOrganization';
  7. import AsyncView from 'app/views/asyncView';
  8. type Props = WithRouterProps<{orgId: string}, {}> & {
  9. organization: Organization;
  10. };
  11. class TeamCreate extends AsyncView<Props> {
  12. getTitle() {
  13. return t('Create Team');
  14. }
  15. getEndpoints(): ReturnType<AsyncView['getEndpoints']> {
  16. return [];
  17. }
  18. handleSubmitSuccess = data => {
  19. const {orgId} = this.props.params;
  20. const redirectUrl = `/settings/${orgId}/teams/${data.slug}/`;
  21. this.props.router.push(redirectUrl);
  22. };
  23. renderBody() {
  24. return (
  25. <NarrowLayout>
  26. <h3>{t('Create a New Team')}</h3>
  27. <CreateTeamForm
  28. onSuccess={this.handleSubmitSuccess}
  29. organization={this.props.organization}
  30. />
  31. </NarrowLayout>
  32. );
  33. }
  34. }
  35. export {TeamCreate};
  36. export default withRouter(withOrganization(TeamCreate));