Merge pull request #593 from kinode-dao/dr/login-redirect

add redirect param to login page for loads where user already has cookie
This commit is contained in:
doria 2024-11-04 22:27:58 +09:00 committed by GitHub
commit 8bdda8a683
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -231,6 +231,17 @@
} }
}); });
}); });
// Check for redirect parameter on page load
document.addEventListener("DOMContentLoaded", () => {
const urlParams = new URLSearchParams(window.location.search);
const redirectPath = urlParams.get('redirect');
if (redirectPath) {
// Ensure the redirect path starts with a slash
const path = redirectPath.startsWith('/') ? redirectPath : '/' + redirectPath;
window.location.href = path;
}
});
</script> </script>
</body> </body>