mirror of
https://github.com/usatiuk/writer.git
synced 2025-10-29 00:17:48 +01:00
submit form on enter
This commit is contained in:
@@ -36,7 +36,8 @@ export class LoginComponent extends React.PureComponent<
|
||||
this.props.history.push("/signup");
|
||||
}
|
||||
|
||||
public submit() {
|
||||
public submit(e: React.FormEvent<any>) {
|
||||
e.preventDefault();
|
||||
const { username, password } = this.state;
|
||||
if (!this.props.inProgress) {
|
||||
this.props.login(username, password);
|
||||
@@ -52,7 +53,7 @@ export class LoginComponent extends React.PureComponent<
|
||||
return (
|
||||
<>
|
||||
<Card className="AuthForm" elevation={2}>
|
||||
<form>
|
||||
<form onSubmit={this.submit}>
|
||||
<div className="header">
|
||||
<H2>Login</H2>
|
||||
<Button
|
||||
@@ -88,6 +89,7 @@ export class LoginComponent extends React.PureComponent<
|
||||
className="submit"
|
||||
intent="primary"
|
||||
icon="log-in"
|
||||
type="submit"
|
||||
onClick={this.submit}
|
||||
disabled={this.props.spinner}
|
||||
>
|
||||
|
||||
@@ -37,7 +37,8 @@ export class SignupComponent extends React.PureComponent<
|
||||
this.props.history.push("/login");
|
||||
}
|
||||
|
||||
public submit() {
|
||||
public submit(e: React.FormEvent<any>) {
|
||||
e.preventDefault();
|
||||
const { username, password, email } = this.state;
|
||||
if (!this.props.inProgress) {
|
||||
this.props.signup(username, password, email);
|
||||
@@ -53,7 +54,7 @@ export class SignupComponent extends React.PureComponent<
|
||||
return (
|
||||
<>
|
||||
<Card className="AuthForm" elevation={2}>
|
||||
<form>
|
||||
<form onSubmit={this.submit}>
|
||||
<div className="header">
|
||||
<H2>Signup</H2>
|
||||
<Button
|
||||
@@ -99,6 +100,7 @@ export class SignupComponent extends React.PureComponent<
|
||||
icon="new-person"
|
||||
className="submit"
|
||||
intent="primary"
|
||||
type="submit"
|
||||
onClick={this.submit}
|
||||
disabled={this.props.spinner}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user