replaced email by user name in header's user tools

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -230,7 +230,7 @@ header[role="banner"]{
} }
.mdi-logout::before { .mdi-logout::before {
margin: -0.25em 0 0 0; margin: -0.25em 0 0 0;
vertical-align: top; vertical-align: baseline;
} }
} }

View File

@ -4,8 +4,8 @@
> --> > -->
<a class="mdi mdi-account" href="/user"> <a class="mdi mdi-account" href="/user">
<span v-if="name">{{ name }}</span> <span>{{ name }}</span>
<span v-else>{{ mail }}</span> <!-- <span v-else>{{ mail }}</span> -->
</a> </a>
<!-- </h4> --> <!-- </h4> -->
<a href="/admin/content/materials" <a href="/admin/content/materials"

View File

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