Skip to content

Instantly share code, notes, and snippets.

@vivainio
Created April 30, 2018 16:26
Show Gist options
  • Save vivainio/2283d073d0a17fac58f83dd20fe31ff2 to your computer and use it in GitHub Desktop.
Save vivainio/2283d073d0a17fac58f83dd20fe31ff2 to your computer and use it in GitHub Desktop.
getPostAndAuthorData = createTransformer((postId: string) => {
const post = this.getPost(postId);
if (!post) return undefined;
const author = this.getAuthor(post.authorId);
if (!author) return undefined;
return {
post,
author
}
});
// in component autorun
this.content = this.postService.getPostAndAuthorData(postId)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment