Disable submit when loading. Fixes #706

This commit is contained in:
Dessalines 2020-06-22 19:05:55 -04:00
parent c1dbeb43c9
commit 63fbf70eaa
5 changed files with 19 additions and 5 deletions

View file

@ -151,7 +151,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
<button <button
type="submit" type="submit"
class="btn btn-sm btn-secondary mr-2" class="btn btn-sm btn-secondary mr-2"
disabled={this.props.disabled} disabled={this.props.disabled || this.state.loading}
> >
{this.state.loading ? ( {this.state.loading ? (
<svg class="icon icon-spinner spin"> <svg class="icon icon-spinner spin">

View file

@ -207,7 +207,11 @@ export class CommunityForm extends Component<
)} )}
<div class="form-group row"> <div class="form-group row">
<div class="col-12"> <div class="col-12">
<button type="submit" class="btn btn-secondary mr-2"> <button
type="submit"
class="btn btn-secondary mr-2"
disabled={this.state.loading}
>
{this.state.loading ? ( {this.state.loading ? (
<svg class="icon icon-spinner spin"> <svg class="icon icon-spinner spin">
<use xlinkHref="#icon-spinner"></use> <use xlinkHref="#icon-spinner"></use>

View file

@ -360,7 +360,9 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
<div class="form-group row"> <div class="form-group row">
<div class="col-sm-10"> <div class="col-sm-10">
<button <button
disabled={!this.state.postForm.community_id} disabled={
!this.state.postForm.community_id || this.state.loading
}
type="submit" type="submit"
class="btn btn-secondary mr-2" class="btn btn-secondary mr-2"
> >

View file

@ -183,7 +183,11 @@ export class PrivateMessageForm extends Component<
)} )}
<div class="form-group row"> <div class="form-group row">
<div class="offset-sm-2 col-sm-10"> <div class="offset-sm-2 col-sm-10">
<button type="submit" class="btn btn-secondary mr-2"> <button
type="submit"
class="btn btn-secondary mr-2"
disabled={this.state.loading}
>
{this.state.loading ? ( {this.state.loading ? (
<svg class="icon icon-spinner spin"> <svg class="icon icon-spinner spin">
<use xlinkHref="#icon-spinner"></use> <use xlinkHref="#icon-spinner"></use>

View file

@ -175,7 +175,11 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
</div> </div>
<div class="form-group row"> <div class="form-group row">
<div class="col-12"> <div class="col-12">
<button type="submit" class="btn btn-secondary mr-2"> <button
type="submit"
class="btn btn-secondary mr-2"
disabled={this.state.loading}
>
{this.state.loading ? ( {this.state.loading ? (
<svg class="icon icon-spinner spin"> <svg class="icon icon-spinner spin">
<use xlinkHref="#icon-spinner"></use> <use xlinkHref="#icon-spinner"></use>