clear local storage when responding

This commit is contained in:
Andrew Malsbury 2023-10-25 19:02:23 +00:00
parent 6a0b291acd
commit ea3e1df784
1 changed files with 7 additions and 0 deletions

View File

@ -39,6 +39,10 @@ document.addEventListener("DOMContentLoaded", function() {
localStorage.setItem(getLocalStorageKey(), JSON.stringify(timeData));
}
function clearTimeStorage() {
localStorage.removeItem(getLocalStorageKey());
}
function startTimer() {
if (timerInterval === null) {
timerInterval = setInterval(countTime, 1000);
@ -121,5 +125,8 @@ document.addEventListener("DOMContentLoaded", function() {
document.getElementById("toggleTimer").addEventListener('click', toggleTimer);
document.getElementById("time_worked").addEventListener('focus', pauseForEdit);
document.getElementById("time_worked").addEventListener('blur', restartAfterEdit);
document.getElementById("ticket_add_reply").addEventListener('click', function() {
clearTimeStorage();
});
});