Register page fixes

This commit is contained in:
Alex Liebowitz 2017-03-30 19:06:06 -04:00 committed by Jeremy Kauffman
parent 98b38855a2
commit 8964398c2e

48
ui/js/page/register.js Normal file
View file

@ -0,0 +1,48 @@
import React from 'react';
import lbryio from '../lbryio.js';
import {getLocal, setLocal} from '../utils.js';
import FormField from '../component/form.js'
import {Link} from '../component/link.js'
const RegisterPage = React.createClass({
_getRewardType: function() {
lbryio.call('reward_type', 'get', this.props.name).then((rewardType) => {
this.setState({
rewardType: rewardType,
});
});
},
handleSubmit: function(event) {
if (event !== 'undefined') {
event.preventDefault();
}
if (!this.state.email) {
this._emailField.warnRequired();
}
},
getInitialState: function() {
return {
rewardType: null,
email: null,
};
},
componentWillMount: function() {
this._getRewardType();
},
render: function() {
return (
<main>
<section className="card">
<h1>Register a LBRY account</h1>
<form onSubmit={this.handleSubmit}>
<section><label>Email <FormField ref={(field) => { this._emailField = field }} type="text" name="email" value={this.state.email} /></label></section>
<div><Link button="primary" label="Submit" onClick={this.handleSubmit} /></div>
</form>
</section>
</main>
);
}
});
export default RegisterPage;