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");
|
this.props.history.push("/signup");
|
||||||
}
|
}
|
||||||
|
|
||||||
public submit() {
|
public submit(e: React.FormEvent<any>) {
|
||||||
|
e.preventDefault();
|
||||||
const { username, password } = this.state;
|
const { username, password } = this.state;
|
||||||
if (!this.props.inProgress) {
|
if (!this.props.inProgress) {
|
||||||
this.props.login(username, password);
|
this.props.login(username, password);
|
||||||
@@ -52,7 +53,7 @@ export class LoginComponent extends React.PureComponent<
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card className="AuthForm" elevation={2}>
|
<Card className="AuthForm" elevation={2}>
|
||||||
<form>
|
<form onSubmit={this.submit}>
|
||||||
<div className="header">
|
<div className="header">
|
||||||
<H2>Login</H2>
|
<H2>Login</H2>
|
||||||
<Button
|
<Button
|
||||||
@@ -88,6 +89,7 @@ export class LoginComponent extends React.PureComponent<
|
|||||||
className="submit"
|
className="submit"
|
||||||
intent="primary"
|
intent="primary"
|
||||||
icon="log-in"
|
icon="log-in"
|
||||||
|
type="submit"
|
||||||
onClick={this.submit}
|
onClick={this.submit}
|
||||||
disabled={this.props.spinner}
|
disabled={this.props.spinner}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ export class SignupComponent extends React.PureComponent<
|
|||||||
this.props.history.push("/login");
|
this.props.history.push("/login");
|
||||||
}
|
}
|
||||||
|
|
||||||
public submit() {
|
public submit(e: React.FormEvent<any>) {
|
||||||
|
e.preventDefault();
|
||||||
const { username, password, email } = this.state;
|
const { username, password, email } = this.state;
|
||||||
if (!this.props.inProgress) {
|
if (!this.props.inProgress) {
|
||||||
this.props.signup(username, password, email);
|
this.props.signup(username, password, email);
|
||||||
@@ -53,7 +54,7 @@ export class SignupComponent extends React.PureComponent<
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card className="AuthForm" elevation={2}>
|
<Card className="AuthForm" elevation={2}>
|
||||||
<form>
|
<form onSubmit={this.submit}>
|
||||||
<div className="header">
|
<div className="header">
|
||||||
<H2>Signup</H2>
|
<H2>Signup</H2>
|
||||||
<Button
|
<Button
|
||||||
@@ -99,6 +100,7 @@ export class SignupComponent extends React.PureComponent<
|
|||||||
icon="new-person"
|
icon="new-person"
|
||||||
className="submit"
|
className="submit"
|
||||||
intent="primary"
|
intent="primary"
|
||||||
|
type="submit"
|
||||||
onClick={this.submit}
|
onClick={this.submit}
|
||||||
disabled={this.props.spinner}
|
disabled={this.props.spinner}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user