Merge branch '606-update-visibility' into 'develop'
Fix #606: Refresh profile after user settings update to avoid cache issues Closes #606 See merge request funkwhale/funkwhale!464
This commit is contained in:
commit
6fe1c3df3f
|
@ -0,0 +1 @@
|
|||
Refresh profile after user settings update to avoid cache issues (#606)
|
|
@ -170,6 +170,9 @@ export default {
|
|||
return axios.patch(url, payload).then(response => {
|
||||
logger.default.info('Updated settings successfully')
|
||||
self.settings.success = true
|
||||
return axios.get('users/users/me/').then((response) => {
|
||||
self.$store.dispatch('auth/updateProfile', response.data)
|
||||
})
|
||||
}, error => {
|
||||
logger.default.error('Error while updating settings')
|
||||
self.isLoading = false
|
||||
|
|
|
@ -119,22 +119,27 @@ export default {
|
|||
|
||||
return axios.get('users/users/me/').then((response) => {
|
||||
logger.default.info('Successfully fetched user profile')
|
||||
let data = response.data
|
||||
commit('authenticated', true)
|
||||
commit('profile', data)
|
||||
commit('username', data.username)
|
||||
dispatch('updateProfile', response.data)
|
||||
dispatch('ui/fetchUnreadNotifications', null, { root: true })
|
||||
dispatch('favorites/fetch', null, { root: true })
|
||||
dispatch('playlists/fetchOwn', null, { root: true })
|
||||
Object.keys(data.permissions).forEach(function (key) {
|
||||
// this makes it easier to check for permissions in templates
|
||||
commit('permission', {key, status: data.permissions[String(key)]})
|
||||
})
|
||||
return response.data
|
||||
}, (response) => {
|
||||
logger.default.info('Error while fetching user profile')
|
||||
})
|
||||
},
|
||||
updateProfile({ commit }, data) {
|
||||
commit("authenticated", true)
|
||||
commit("profile", data)
|
||||
commit("username", data.username)
|
||||
Object.keys(data.permissions).forEach(function(key) {
|
||||
// this makes it easier to check for permissions in templates
|
||||
commit("permission", {
|
||||
key,
|
||||
status: data.permissions[String(key)]
|
||||
})
|
||||
})
|
||||
},
|
||||
refreshToken ({commit, dispatch, state}) {
|
||||
return axios.post('token/refresh/', {token: state.token}).then(response => {
|
||||
logger.default.info('Refreshed auth token')
|
||||
|
|
Loading…
Reference in New Issue