From 9eb3ab91fb653ca6d4921238e2a497427405f178 Mon Sep 17 00:00:00 2001
From: realtradam <github@tradam.dev>
Date: Fri, 28 Jun 2024 17:25:36 -0400
Subject: add login

---
 react-frontend/src/pages/CloseWindow.tsx | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 react-frontend/src/pages/CloseWindow.tsx

(limited to 'react-frontend/src/pages/CloseWindow.tsx')

diff --git a/react-frontend/src/pages/CloseWindow.tsx b/react-frontend/src/pages/CloseWindow.tsx
new file mode 100644
index 0000000..b92d77e
--- /dev/null
+++ b/react-frontend/src/pages/CloseWindow.tsx
@@ -0,0 +1,19 @@
+
+export default function CloseWindow () {
+
+	// trigger localStorage listener in other tabs.
+	// this forces react rerender where required.
+	localStorage.setItem("logged in trigger", String(Math.random()));
+	// close window once done
+	window.close();
+
+	// window can only be closed if it was opened by javascript.
+	// if the window was opened by a user then just redirect to
+	// the home page instead.
+	window.location.replace("/");
+
+	return(
+		<>
+		</>
+	);
+}
-- 
cgit v1.2.3

