Skip to content

Commit

Permalink
Moving checks around
Browse files Browse the repository at this point in the history
  • Loading branch information
Angamanga committed Nov 15, 2024
1 parent 69606a7 commit 96da7df
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,17 @@ export class PostDetailsComponent extends BaseComponent implements OnChanges, On
private async getPost(id: number): Promise<void> {
if (!this.postId) return;
this.post = await this.getPostInformation(id);
if (this.post?.form_id) {
if (this.post && this.post.form_id) {
const form = await lastValueFrom(this.surveyService.getById(this.post.form_id!));
this.post.form = form.result;
this.getData(this.post);
this.preparePostForView();
} else {
this.postChanged = false;
}
this.getData(this.post);
this.preparePostForView();
//----------------------
//----------------------
}

private async getData(post: PostResult): Promise<void> {
if (!post.form_id) {
this.postChanged = false;
return;
}
for (const content of post.post_content as PostContent[]) {
this.preparingSafeVideoUrls(content.fields);
this.preparingRelatedPosts(content.fields);
Expand Down

0 comments on commit 96da7df

Please sign in to comment.