From 272af85c7496ddd64b05685c5d73f1a173a8c191 Mon Sep 17 00:00:00 2001 From: UnEpicier Date: Sun, 18 Feb 2024 18:06:40 +0100 Subject: [PATCH] :bug: Saving time score only on winning --- src/components/Stats/Timer/Timer.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Stats/Timer/Timer.tsx b/src/components/Stats/Timer/Timer.tsx index 5462b67..ef7f6bd 100644 --- a/src/components/Stats/Timer/Timer.tsx +++ b/src/components/Stats/Timer/Timer.tsx @@ -62,7 +62,10 @@ const Timer = () => { })); clearInterval(intervalId); - saveToLocalStorage(displayedTime); + + if (gameState.endType === 'win') { + saveToLocalStorage(displayedTime); + } } }, [intervalId, gameState.endType, setGameState, displayedTime]);