Created
August 26, 2022 09:22
-
-
Save MariusBongarts/3e1d3b593d989ee52c47bf273636d58b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fetchOpenGraphMetaData() { | |
| const encodedUrl = encodeURIComponent(this.url); | |
| const url = `${this.apiUrl}?url=${encodedUrl}`; | |
| fetch(url) | |
| .then(async (data) => { | |
| try { | |
| this.metaData = (await data.json()) as OpenGraphMetaData; | |
| } catch (error) { | |
| this.metaData = {}; | |
| } | |
| }) | |
| .catch(() => (this.metaData = {})); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment