Skip to content

Commit

Permalink
feat: refresh users avatar in header when the user changes their icon…
Browse files Browse the repository at this point in the history
… in their profile
  • Loading branch information
akinsey committed Sep 27, 2021
1 parent f46e31a commit 4c5b781
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/images/ImageUploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default {
}
// update loading status
function updateImagesUploading(index, percent, url) {
const updateImagesUploading = (index, percent, url) => {
// on successful update
if (percent) {
// update images' progress sum
Expand Down
1 change: 1 addition & 0 deletions src/components/layout/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ export default {
breadcrumbs: [{label:'Home', state: '#', opts: {}}]
})
watch(() => $auth.user, u => v.currentUser = u, { deep: true })
watch(() => $route.path, p => v.hideAnnnouncement = v.motdData?.main_view_only && p !== '' && p !== '/')
watch(() => NotificationsStore.messages, c => v.notificationMessages = c)
watch(() => NotificationsStore.mentions, c => v.notificationMentions = c)
Expand Down
3 changes: 3 additions & 0 deletions src/components/modals/profile/UpdateAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Modal from '@/components/layout/Modal.vue'
import { reactive, toRefs, inject } from 'vue'
import { usersApi } from '@/api'
import { cloneDeep } from 'lodash'
import { AuthStore } from '@/composables/stores/auth'
export default {
name: 'update-avatar-modal',
Expand All @@ -55,6 +56,7 @@ export default {
v.userCopy.avatar = data.avatar
$alertStore.success(`Successfully updated avatar for user ${params.username}`)
Object.assign(v.userReactive, v.userCopy)
$auth.reauthenticate()
})
.catch(() => v.errorMessage = 'There was an error updating avatar.')
.finally(() => v.errorMessage ? null : close())
Expand All @@ -69,6 +71,7 @@ export default {
const uploadError = err => v.errorMessage = err
/* Internal Data */
const $alertStore = inject('$alertStore')
const $auth = inject(AuthStore)
/* Template Data */
const v = reactive({
Expand Down

0 comments on commit 4c5b781

Please sign in to comment.