mirror of
https://github.com/Afilmory/afilmory
synced 2026-04-24 23:05:05 +00:00
fix: improve page redirect handling for tenant sessions
- Refactored the page redirect logic to ensure proper session clearance for placeholder tenants. - Added an asynchronous function to handle sign-out before redirecting to the target URL, with error logging for better debugging. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -163,7 +163,7 @@ export function usePageRedirect() {
|
||||
return
|
||||
}
|
||||
|
||||
const {tenant} = session
|
||||
const { tenant } = session
|
||||
if (!tenant || tenant.isPlaceholder || !tenant.slug) {
|
||||
return
|
||||
}
|
||||
@@ -179,7 +179,15 @@ export function usePageRedirect() {
|
||||
|
||||
try {
|
||||
const targetUrl = buildTenantUrl(tenant.slug, '/')
|
||||
window.location.replace(targetUrl)
|
||||
;(async () => {
|
||||
try {
|
||||
await signOutBySource()
|
||||
} catch (error) {
|
||||
console.error('Failed to clear placeholder session before redirect', error)
|
||||
} finally {
|
||||
window.location.replace(targetUrl)
|
||||
}
|
||||
})()
|
||||
} catch (error) {
|
||||
console.error('Failed to redirect to tenant workspace', error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user