Redirect to custom login page when client navigates to /login or /register
This commit is contained in:
parent
7b59049a89
commit
879bfa7391
13
api/assets/preload-plugins/loginRedirect.js
Normal file
13
api/assets/preload-plugins/loginRedirect.js
Normal file
@ -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();
|
Loading…
x
Reference in New Issue
Block a user