From eb01cbbbdec274f7e1bcf2cbec1b91c0538dc1f4 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 24 Jan 2020 18:49:47 +0100 Subject: [PATCH] Fix post input resetting just when post was successful --- src/app/components/feed/feed.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/components/feed/feed.component.ts b/src/app/components/feed/feed.component.ts index 44eee90..f888af1 100644 --- a/src/app/components/feed/feed.component.ts +++ b/src/app/components/feed/feed.component.ts @@ -65,6 +65,7 @@ export class FeedComponent implements OnInit { }); this.feedService.posting.subscribe(posting => { this.posting = posting; + this.resetPostInput(); }); } @@ -78,18 +79,18 @@ export class FeedComponent implements OnInit { this.posting = true; this.feedService.createPostActivity(postElement.value, activityId, this.file).subscribe(() => { postElement.value = ''; - this.resetPostInput(); }, (error: IErrorResponse) => { this.errorOccurred = true; + this.posting = false; this.errorMessage = error.error.errors[0].message; }); } else if (postElement) { this.posting = true; this.feedService.createPost(postElement.value, this.file).subscribe((result) => { postElement.value = ''; - this.resetPostInput(); }, (error: IErrorResponse) => { console.log(error); + this.posting = false; this.errorOccurred = true; this.errorMessage = error.error.errors[0].message; });