settings.js: remove reason banner when enabling

This commit is contained in:
codl 2017-09-02 19:51:59 +02:00
parent 1d677de7b4
commit 73b7ee2a53
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 4 additions and 0 deletions

View File

@ -168,9 +168,13 @@ import Banner from '../components/Banner.html';
} }
set_viewer_timeout(); set_viewer_timeout();
let reason_banner = document.querySelector('.banner[data-reason]');
banner.on('toggle', enabled => { banner.on('toggle', enabled => {
send_settings({policy_enabled: enabled}).then(fetch_viewer).then(update_viewer); send_settings({policy_enabled: enabled}).then(fetch_viewer).then(update_viewer);
if(enabled && reason_banner){
reason_banner.parentElement.removeChild(reason_banner);
}
// TODO show error or spinner if it takes over a second // TODO show error or spinner if it takes over a second
}) })
})(); })();