Fix login redirect to use absolute URL
- Use window.location.origin for redirect to ensure it works from any path - Redirects to chat (#chat) after successful authentication - Maintains support for custom redirect parameter
This commit is contained in:
parent
375b457f48
commit
5e10222a94
1 changed files with 4 additions and 4 deletions
|
|
@ -1266,16 +1266,16 @@
|
|||
if (response.redirect || response.success) {
|
||||
// Check for redirect parameter in URL
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const redirectUrl = urlParams.get('redirect') || response.redirect || "/#chat";
|
||||
window.location.href = redirectUrl;
|
||||
const redirectUrl = urlParams.get('redirect') || response.redirect;
|
||||
window.location.href = redirectUrl ? redirectUrl : window.location.origin + "/#chat";
|
||||
}
|
||||
} catch (e) {
|
||||
// If response is not JSON, check for redirect header
|
||||
if (event.detail.xhr.status === 200) {
|
||||
// Check for redirect parameter in URL
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const redirectUrl = urlParams.get('redirect') || "/#chat";
|
||||
window.location.href = redirectUrl;
|
||||
const redirectUrl = urlParams.get('redirect');
|
||||
window.location.href = redirectUrl ? redirectUrl : window.location.origin + "/#chat";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue