summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/assets/preload-plugins/loginRedirect.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/api/assets/preload-plugins/loginRedirect.js b/api/assets/preload-plugins/loginRedirect.js
new file mode 100644
index 00000000..895536ef
--- /dev/null
+++ b/api/assets/preload-plugins/loginRedirect.js
@@ -0,0 +1,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();
\ No newline at end of file