Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Von
funkwhale
Commits
3d3175f3
Verified
Commit
3d3175f3
authored
Nov 09, 2018
by
Eliot Berriot
Browse files
Fix #606: Refresh profile after user settings update to avoid cache issues
parent
6458a748
Changes
3
Hide whitespace changes
Inline
Side-by-side
changes/changelog.d/606.bugfix
0 → 100644
View file @
3d3175f3
Refresh profile after user settings update to avoid cache issues (#606)
front/src/components/auth/Settings.vue
View file @
3d3175f3
...
...
@@ -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
...
...
front/src/store/auth.js
View file @
3d3175f3
...
...
@@ -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
'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment