Fix post input resetting just when post was successful

master
Max 5 years ago
parent 34d75b6544
commit eb01cbbbde

@ -65,6 +65,7 @@ export class FeedComponent implements OnInit {
}); });
this.feedService.posting.subscribe(posting => { this.feedService.posting.subscribe(posting => {
this.posting = posting; this.posting = posting;
this.resetPostInput();
}); });
} }
@ -78,18 +79,18 @@ export class FeedComponent implements OnInit {
this.posting = true; this.posting = true;
this.feedService.createPostActivity(postElement.value, activityId, this.file).subscribe(() => { this.feedService.createPostActivity(postElement.value, activityId, this.file).subscribe(() => {
postElement.value = ''; postElement.value = '';
this.resetPostInput();
}, (error: IErrorResponse) => { }, (error: IErrorResponse) => {
this.errorOccurred = true; this.errorOccurred = true;
this.posting = false;
this.errorMessage = error.error.errors[0].message; this.errorMessage = error.error.errors[0].message;
}); });
} else if (postElement) { } else if (postElement) {
this.posting = true; this.posting = true;
this.feedService.createPost(postElement.value, this.file).subscribe((result) => { this.feedService.createPost(postElement.value, this.file).subscribe((result) => {
postElement.value = ''; postElement.value = '';
this.resetPostInput();
}, (error: IErrorResponse) => { }, (error: IErrorResponse) => {
console.log(error); console.log(error);
this.posting = false;
this.errorOccurred = true; this.errorOccurred = true;
this.errorMessage = error.error.errors[0].message; this.errorMessage = error.error.errors[0].message;
}); });

Loading…
Cancel
Save