aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/auth/Invite.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/auth/Invite.js')
-rw-r--r--src/components/auth/Invite.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/components/auth/Invite.js b/src/components/auth/Invite.js
index 9c32220f8..2776af05f 100644
--- a/src/components/auth/Invite.js
+++ b/src/components/auth/Invite.js
@@ -5,6 +5,8 @@ import { defineMessages, intlShape } from 'react-intl';
5import { Link } from 'react-router'; 5import { Link } from 'react-router';
6import classnames from 'classnames'; 6import classnames from 'classnames';
7 7
8import Infobox from '../ui/Infobox';
9import Appear from '../ui/effects/Appear';
8import Form from '../../lib/Form'; 10import Form from '../../lib/Form';
9import { email } from '../../helpers/validation-helpers'; 11import { email } from '../../helpers/validation-helpers';
10import Input from '../ui/Input'; 12import Input from '../ui/Input';
@@ -70,9 +72,17 @@ export default class Invite extends Component {
70 72
71 submit(e) { 73 submit(e) {
72 e.preventDefault(); 74 e.preventDefault();
75
76 const from = this.props.from;
77
73 this.form.submit({ 78 this.form.submit({
74 onSuccess: (form) => { 79 onSuccess: (form) => {
75 this.props.onSubmit({ invites: form.values().invite }); 80 this.props.onSubmit({
81 invites: form.values().invite,
82 from
83 });
84 this.form.clear()
85 this.form.$('invite').$('0').focus()
76 }, 86 },
77 onError: () => {}, 87 onError: () => {},
78 }); 88 });
@@ -81,7 +91,7 @@ export default class Invite extends Component {
81 render() { 91 render() {
82 const { form } = this; 92 const { form } = this;
83 const { intl } = this.context; 93 const { intl } = this.context;
84 const { from, embed } = this.props; 94 const { from, embed, success } = this.props;
85 95
86 const atLeastOneEmailAddress = form.$('invite') 96 const atLeastOneEmailAddress = form.$('invite')
87 .map(invite => invite.$('email').value) 97 .map(invite => invite.$('email').value)
@@ -92,7 +102,20 @@ export default class Invite extends Component {
92 'invite__embed--button': embed, 102 'invite__embed--button': embed,
93 }); 103 });
94 104
105 console.log(success)
106
95 return ( 107 return (
108 <div>
109 {(success && <Appear>
110 <Infobox
111 type="success"
112 icon="checkbox-marked-circle-outline"
113 dismissable
114 >
115 Great Success!
116 </Infobox>
117 </Appear>)}
118
96 <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> 119 <form className="franz-form auth__form" onSubmit={e => this.submit(e)}>
97 {!embed && (<img 120 {!embed && (<img
98 src="./assets/images/logo.svg" 121 src="./assets/images/logo.svg"
@@ -123,6 +146,7 @@ export default class Invite extends Component {
123 {intl.formatMessage(messages.skipButtonLabel)} 146 {intl.formatMessage(messages.skipButtonLabel)}
124 </Link>)} 147 </Link>)}
125 </form> 148 </form>
149 </div>
126 ); 150 );
127 } 151 }
128} 152}