note cache fixes for created notes

This commit is contained in:
zadam
2020-05-13 23:06:13 +02:00
parent 7992f32d34
commit a287bb59ea
4 changed files with 71 additions and 46 deletions

View File

@@ -12,15 +12,19 @@ setInterval(() => {
resetProtectedSession();
}
}, 5000);
}, 10000);
function setProtectedSessionId(id) {
// using session cookie so that it disappears after browser/tab is closed
utils.setSessionCookie(PROTECTED_SESSION_ID_KEY, id);
}
function resetProtectedSession() {
function resetSessionCookie() {
utils.setSessionCookie(PROTECTED_SESSION_ID_KEY, null);
}
function resetProtectedSession() {
resetSessionCookie();
// most secure solution - guarantees nothing remained in memory
// since this expires because user doesn't use the app, it shouldn't be disruptive
@@ -47,8 +51,9 @@ function touchProtectedSessionIfNecessary(note) {
export default {
setProtectedSessionId,
resetSessionCookie,
resetProtectedSession,
isProtectedSessionAvailable,
touchProtectedSession,
touchProtectedSessionIfNecessary
};
};