Skip to content

Commit

Permalink
feat: add empty source checks
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jun 26, 2021
1 parent a726780 commit 24b0030
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/pages/posts/post/Post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,18 @@ export default {
// #region Post media
isUrl() {
if (!this.post.data.source.length) {
return false
}
return this.post.data.source[0].startsWith('http', 'www')
},
sourceText() {
if (!this.post.data.source.length) {
return null
}
if (this.isUrl) {
return new URL(this.post.data.source[0]).hostname
}
Expand Down

0 comments on commit 24b0030

Please sign in to comment.