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 {
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">
<span v-if="name">{{ name }}</span>
<span v-else>{{ mail }}</span>
<span>{{ name }}</span>
<!-- <span v-else>{{ mail }}</span> -->
</a>
<!-- </h4> -->
<a href="/admin/content/materials"

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')