mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Update frontend to display urls, update currentUser
This commit is contained in:
parent
59e488f48a
commit
edd37db8fe
@ -58,7 +58,8 @@ export default {
|
|||||||
}),
|
}),
|
||||||
socialMediaLinks() {
|
socialMediaLinks() {
|
||||||
const { socialMedia = [] } = this.currentUser
|
const { socialMedia = [] } = this.currentUser
|
||||||
return socialMedia.map(url => {
|
return socialMedia.map(socialMedia => {
|
||||||
|
const { url } = socialMedia
|
||||||
const matches = url.match(
|
const matches = url.match(
|
||||||
/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:\/\n?]+)/g
|
/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:\/\n?]+)/g
|
||||||
)
|
)
|
||||||
@ -77,14 +78,19 @@ export default {
|
|||||||
.mutate({
|
.mutate({
|
||||||
mutation: gql`
|
mutation: gql`
|
||||||
mutation($url: String!) {
|
mutation($url: String!) {
|
||||||
CreateSocialMedia(url: $url)
|
CreateSocialMedia(url: $url) {
|
||||||
|
url
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
variables: {
|
variables: {
|
||||||
url: this.value
|
url: this.value
|
||||||
},
|
},
|
||||||
update: (store, { data }) => {
|
update: (store, { data }) => {
|
||||||
const socialMedia = data.addSocialMedia
|
const socialMedia = [
|
||||||
|
...this.currentUser.socialMedia,
|
||||||
|
data.CreateSocialMedia
|
||||||
|
]
|
||||||
this.setCurrentUser({
|
this.setCurrentUser({
|
||||||
...this.currentUser,
|
...this.currentUser,
|
||||||
socialMedia
|
socialMedia
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user