From 460f06b9e4d2d88e12d03e09f631a41b1b6bf206 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sat, 27 Jan 2024 02:09:40 -0800
Subject: feat(layout): reset identity on commit

---
 src/routes/+layout.svelte | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'src/routes/+layout.svelte')

diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index c56c42be..0acc3b98 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -46,10 +46,17 @@
 		: -200;
 
 	onMount(async () => {
-		if (browser && localStorage.getItem('redirect')) {
-			window.location.href = localStorage.getItem('redirect') ?? '/';
+		if (browser) {
+			if (localStorage.getItem('redirect')) {
+				window.location.href = localStorage.getItem('redirect') ?? '/';
 
-			localStorage.removeItem('redirect');
+				localStorage.removeItem('redirect');
+			}
+
+			if (localStorage.getItem('commit') !== data.commit) {
+				localStorage.removeItem('identity');
+				localStorage.setItem('commit', data.commit);
+			}
 		}
 
 		settings.get();
-- 
cgit v1.2.3

