update: resolve !150

This commit is contained in:
Jean-Baptiste Pasquier 2019-10-02 16:56:49 +02:00
parent c72ff3f6c1
commit 93895d166f
No known key found for this signature in database
GPG Key ID: F2702E6D22ED4D62
2 changed files with 8 additions and 5 deletions

View File

@ -52,6 +52,10 @@ nav#main__menu
widget-name='sib-display-div', widget-name='sib-display-div',
widget-badge='hd-counter' widget-badge='hd-counter'
action-badge='badge' action-badge='badge'
search-fields='team'
search-widget-team='sib-form-hidden'
search-value-team=''
set-user-id='search-value-team'
order-by='name' order-by='name'
next='circle' next='circle'
) )

View File

@ -37,12 +37,11 @@ document.addEventListener('DOMContentLoaded', function (event) {
document.querySelector('sib-auth').getUser().then(user => { document.querySelector('sib-auth').getUser().then(user => {
if(user !== null) { if(user !== null) {
// Hide login button if already logged
document.querySelector('button[role="log in"]').style.display = 'none'; document.querySelector('button[role="log in"]').style.display = 'none';
//- Token expired, hack for ask relogin // Set current user id on set-user-id of sib-display
if(new Date(document.querySelector('sib-auth').getUser().expires_at*1000) <= new Date()) { for(sibDisplay of document.querySelectorAll('sib-display[set-user-id]')) {
document.querySelector('button[role="log in"]').style.display = ''; sibDisplay.setAttribute(sibDisplay.getAttribute('set-user-id'), user['@id']);
document.querySelector('button[role="log in"]').style.color = 'red';
document.querySelector('button[role="log in"]').innerHTML = 'Re-login';
} }
} }
}).catch(error => console.log(error)); }).catch(error => console.log(error));