Merge branch 'jbpasquier/handle-login-button' into 'staging'

ui: hide or show login button

See merge request startinblox/applications/sib-app!41
This commit is contained in:
Gaëlle Morin 2019-06-05 11:43:43 +00:00
commit 0702e890e4

View File

@ -25,4 +25,15 @@ document.addEventListener('DOMContentLoaded', function (event) {
})
});
//- Header login hide/show
if(document.querySelector('sib-auth').getUser() !== null) {
document.querySelector('button[role="log in"]').style.display = 'none';
//- Token expired, hack for ask relogin
if(new Date(document.querySelector('sib-auth').getUser().expires_at*1000) <= new Date()) {
document.querySelector('button[role="log in"]').style.display = '';
document.querySelector('button[role="log in"]').style.color = 'red';
document.querySelector('button[role="log in"]').innerHTML = 'Re-login';
}
}
});