refactor: function to set as saved

This commit is contained in:
quenousimporte 2023-10-02 12:33:45 +02:00
parent ca29382b55
commit 95eca37ebc
1 changed files with 9 additions and 4 deletions

13
main.js
View File

@ -1989,6 +1989,11 @@ function postpone()
}); });
} }
function setsaved()
{
saved = true;
}
function save() function save()
{ {
clearTimeout(workerid); clearTimeout(workerid);
@ -1998,13 +2003,13 @@ function save()
settings = JSON.parse(md.value); settings = JSON.parse(md.value);
savesettings(); savesettings();
loadsettings(); loadsettings();
saved = true; setsaved();
return; return;
} }
else if (currentnote.title == "pgpkeys") else if (currentnote.title == "pgpkeys")
{ {
localStorage.setItem("pgpkeys", md.value); localStorage.setItem("pgpkeys", md.value);
saved = true; setsaved();
return; return;
} }
@ -2053,7 +2058,7 @@ function save()
.then(() => .then(() =>
{ {
console.log("...data saved on server"); console.log("...data saved on server");
saved = true; setsaved();
}) })
.catch(remotecallfailed) .catch(remotecallfailed)
.finally(() => .finally(() =>
@ -2072,7 +2077,7 @@ function save()
} }
else else
{ {
saved = true; setsaved();
} }
} }