mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Fix render error bug
🙌 @mattwr18
This commit is contained in:
parent
8fb9ebd2b5
commit
9de652c631
@ -18,19 +18,19 @@
|
||||
</ds-button>
|
||||
</div>
|
||||
</ds-space>
|
||||
<ds-space
|
||||
v-if="currentUser.socialMedia && currentUser.socialMedia.length"
|
||||
<ds-space
|
||||
v-if="socialMediaLinks"
|
||||
margin-top="base"
|
||||
margin="x-small"
|
||||
>
|
||||
<div
|
||||
v-for="socialMediaIconUrl in currentUser.socialMedia"
|
||||
:key="socialMediaIconUrl"
|
||||
v-for="link in socialMediaLinks"
|
||||
:key="link.url"
|
||||
>
|
||||
<a>
|
||||
<img
|
||||
:src="socialMediaIconUrl.match(/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:\/\n?]+)/g)[0] + '/favicon.ico'"
|
||||
:href="socialMediaIconUrl"
|
||||
:src="link.favicon"
|
||||
:href="link.url"
|
||||
alt=""
|
||||
>
|
||||
</a>
|
||||
@ -51,7 +51,18 @@ export default {
|
||||
computed: {
|
||||
...mapGetters({
|
||||
currentUser: 'auth/user'
|
||||
})
|
||||
}),
|
||||
socialMediaLinks() {
|
||||
const { socialMedia = [] } = this.currentUser
|
||||
return socialMedia.map(url => {
|
||||
const matches = url.match(
|
||||
/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:\/\n?]+)/g
|
||||
)
|
||||
const [domain] = matches || []
|
||||
const favicon = domain ? `${domain}/favicon.ico` : null
|
||||
return { url, favicon }
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleAddSocialMedia() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user