replaced email by user name in header's user tools

This commit is contained in:
2022-03-12 21:57:35 +01:00
parent a2a53addf3
commit fc1124b696
7 changed files with 28 additions and 27 deletions

View File

@ -65,6 +65,7 @@ export default {
setUser (state, data) {
state.mail = data.mail[0].value
state.uuid = data.uuid[0].value
state.name = data.name[0].value
// with session_limit, only here we are certain that the user is logged
state.isloggedin = true
},
@ -93,10 +94,10 @@ export default {
state.hasDBAccess = true
}
},
setName (state, name) {
console.log('setName', name)
state.name = name
},
// setName (state, name) {
// console.log('setName', name)
// state.name = name
// },
setLoggedOut (state) {
console.log('setLoggedOut state', state)
state.uid = null
@ -248,10 +249,10 @@ export default {
if (data.roles) {
commit('setRoles', data.roles)
}
console.log('customer_profiles', data.customer_profiles.length)
if (data.customer_profiles.length) {
dispatch('getUserProfiles', data.customer_profiles[data.customer_profiles.length - 1].target_id)
}
// console.log('customer_profiles', data.customer_profiles.length)
// if (data.customer_profiles.length) {
// dispatch('getUserProfiles', data.customer_profiles[data.customer_profiles.length - 1].target_id)
// }
dispatch('getUserFlagColls')
resolve()
})
@ -262,20 +263,20 @@ export default {
})
})
},
getUserProfiles ({ dispatch, commit, state }, pid) {
const params = {
token: state.csrf_token
}
REST.get(`/profile/${pid}?_format=json`, params).then(({ data }) => {
console.log('profile', data)
if (data.address.length) {
commit('setName', `${data.address[0].given_name} ${data.address[0].family_name} `)
}
}).catch(error => {
console.warn('Issue with getUser', error)
Promise.reject(error)
})
},
// getUserProfiles ({ dispatch, commit, state }, pid) {
// const params = {
// token: state.csrf_token
// }
// REST.get(`/profile/${pid}?_format=json`, params).then(({ data }) => {
// console.log('profile', data)
// if (data.address.length) {
// commit('setName', `${data.address[0].given_name} ${data.address[0].family_name} `)
// }
// }).catch(error => {
// console.warn('Issue with getUser', error)
// Promise.reject(error)
// })
// },
getUserFlagColls ({ dispatch, commit, state }) {
// flags
// REST.get('/flagging_collection/1?_format=json')