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