summary refs log tree commit diff
path: root/api/assets/preload-plugins/loginRedirect.js
blob: 895536efffbd09410dd5daf90104d4b6921da2ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
const redirectIfOnLogin = () => {
	const path = window.location.pathname;
	if (path == "/login" || path == "/register") {
		window.location.reload();
	}
}

const observer = new MutationObserver((mutations) => {
	redirectIfOnLogin();
});
observer.observe(document, { subtree: true, childList: true })

redirectIfOnLogin();