Reset UI when all backups deleted

This commit is contained in:
projectmoon 2023-01-09 16:49:47 +01:00
parent b2fa05060d
commit 2cdab82bfd
1 changed files with 3 additions and 4 deletions

View File

@ -206,14 +206,11 @@ async function initEvents() {
}
function reset() {
//real body shown
//minibar hidden
//initial stuff shown
showApplication(true);
showNotLoadedControls();
hideErrors();
removeChildren(ui.chatDisplay);
history.replaceState(null, 'MSN Viewer', '');
history.pushState(null, 'MSN Viewer', '/');
document.title = 'MSN Viewer';
}
@ -221,6 +218,7 @@ async function deleteBackup(e: MouseEvent) {
const el = e.currentTarget as HTMLElement;
const anchor = el.closest('a.backup-entry') as HTMLAnchorElement | null;
const filename = anchor?.dataset['filename'];
if (filename) {
if (window.confirm('Do you want to remove ' + filename + ' from the backup list?')) {
try {
@ -231,6 +229,7 @@ async function deleteBackup(e: MouseEvent) {
populateSavedBackups();
} else {
toggleLoadPrevious(false);
reset();
}
} catch (e) {
displayNonFatalError('Could not remove backup', e as Error);