Skip to content

Instantly share code, notes, and snippets.

@umutyerebakmaz
Created January 8, 2020 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umutyerebakmaz/7b27194db5d0e920faa6a5ff7f870726 to your computer and use it in GitHub Desktop.
Save umutyerebakmaz/7b27194db5d0e920faa6a5ff7f870726 to your computer and use it in GitHub Desktop.
ngOnInit() {
this.route.params.subscribe(params => {
this.getUser(params.slug);
});
}
getUser(slug: string) {
this.user$ = this.userPageUserGQL
.watch({ slug: slug }, {
fetchPolicy: 'cache-first'
}).valueChanges.pipe(
map(result => result.data.user)
);
}
updateTag(obj: any) {
const pageTitle = `${obj.firstName + ' ' + obj.lastName} (@${obj.userName})`;
this.seoService.addTitle(pageTitle);
this.seoService.addDefaultMetaTags();
this.seoService.meta.updateTag({ property: 'og:title', content: pageTitle });
this.seoService.meta.updateTag({ property: 'og:description', content: pageTitle });
this.seoService.meta.updateTag({ name: 'description', content: pageTitle });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment