mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Update currentUser after successful addSocialMedia mutation
Co-authored-by: Mike Aono <aonomike@gmail.com>
This commit is contained in:
parent
78ec42e000
commit
94288ced54
@ -13,7 +13,9 @@
|
||||
<a :href="link.url">
|
||||
<img
|
||||
:src="link.favicon"
|
||||
alt=""
|
||||
alt="Social Media link"
|
||||
width="16"
|
||||
height="16"
|
||||
>
|
||||
{{ link.url }}
|
||||
</a>
|
||||
@ -42,7 +44,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import gql from 'graphql-tag'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { mapGetters, mapMutations } from 'vuex'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -67,6 +69,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations({
|
||||
setCurrentUser: 'auth/SET_USER'
|
||||
}),
|
||||
handleAddSocialMedia() {
|
||||
this.$apollo
|
||||
.mutate({
|
||||
@ -77,9 +82,19 @@ export default {
|
||||
`,
|
||||
variables: {
|
||||
url: this.value
|
||||
},
|
||||
update: (store, { data }) => {
|
||||
const socialMedia = data.addSocialMedia
|
||||
this.setCurrentUser({
|
||||
...this.currentUser,
|
||||
socialMedia
|
||||
})
|
||||
}
|
||||
})
|
||||
.then(this.$toast.success(this.$t('settings.social-media.success')))
|
||||
.then(
|
||||
this.$toast.success(this.$t('settings.social-media.success')),
|
||||
(this.value = '')
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user