summaryrefslogtreecommitdiffhomepage
path: root/src/components/CloseWindow.tsx
blob: bb33e0a7df4dd56895a884eee5cb48f2d0257ede (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//import { Link } from "react-router-dom";

//export default () => (
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(
		<>
		</>
	);
}