Skip to content

Commit 75d5a50

Browse files
committed
Adding extra check for form_id and displaying messages in detailed view (#1461)
* Adding extra check for form_id and displaying messages in detailed view * Checking for form_id instead of post_content * Moving checks around
1 parent f9c0e1a commit 75d5a50

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

apps/web-mzima-client/src/app/post/post-details/post-details.component.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,13 @@ export class PostDetailsComponent extends BaseComponent implements OnChanges, On
117117
private async getPost(id: number): Promise<void> {
118118
if (!this.postId) return;
119119
this.post = await this.getPostInformation(id);
120-
if (this.post) {
121-
this.surveyService.getById(this.post.form_id!).subscribe((form) => {
122-
this.post!.form = form.result;
123-
this.getData(this.post);
124-
});
120+
if (this.post && this.post.form_id) {
121+
const form = await lastValueFrom(this.surveyService.getById(this.post.form_id!));
122+
this.post.form = form.result;
123+
this.getData(this.post);
125124
this.preparePostForView();
126-
//----------------------
127-
//----------------------
125+
} else {
126+
this.postChanged = false;
128127
}
129128
}
130129

0 commit comments

Comments
 (0)