added spinner for comments

This commit is contained in:
Isaac Visintainer 2019-07-04 12:13:41 -07:00
parent 3cf2af8f12
commit 223c2f9ba0
2 changed files with 9 additions and 5 deletions

View File

@ -28,6 +28,7 @@ export class Comments extends Component {
}
postComment() {
this.props.setSpinner(true);
let comment = {
"new-comment": {
who: this.props.ship,
@ -43,14 +44,16 @@ export class Comments extends Component {
blogId: this.props.blogId,
postId: this.props.postId,
}
}, () => {
this.props.api.action("write", "write-action", comment)
});
this.props.api.action("write", "write-action", comment);
}
componentDidUpdate(prevProps, prevState) {
if (this.state.awaiting) {
if (prevProps.comments != this.props.comments) {
this.props.setSpinner(false);
this.setState({awaiting: false, commentBody: ''});
}
}

View File

@ -65,6 +65,7 @@ export class Post extends Component {
}
savePost() {
this.props.setSpinner(true);
if (this.state.title == this.state.titleOriginal &&
this.state.body == this.state.bodyOriginal) {
return;
@ -100,11 +101,9 @@ export class Post extends Component {
blogId: this.props.blogId,
postId: this.props.postId,
}
}, () => {
this.props.api.action("write", "write-action", data)
});
this.props.setSpinner(true);
this.props.api.action("write", "write-action", data);
}
componentWillMount() {
@ -346,6 +345,7 @@ export class Post extends Component {
ship={this.props.ship}
blogId={this.props.blogId}
postId={this.props.postId}
setSpinner={this.props.setSpinner}
/>
</div>
</div>
@ -400,6 +400,7 @@ export class Post extends Component {
ship={this.props.ship}
blogId={this.props.blogId}
postId={this.props.postId}
setSpinner={this.props.setSpinner}
/>
</div>
</div>