Corrige redirect do portal após reset do dispositivo
All checks were successful
All checks were successful
This commit is contained in:
parent
84117e6821
commit
89f756e088
1 changed files with 7 additions and 13 deletions
|
|
@ -42,19 +42,13 @@ export function PortalShell({ children }: PortalShellProps) {
|
|||
|
||||
const handleTokenRevoked = useCallback(() => {
|
||||
console.log("[PortalShell] Token foi revogado - redirecionando para tela de registro")
|
||||
toast.error("Este dispositivo foi resetado. Faça login novamente.")
|
||||
// Se estiver rodando dentro do Tauri, navega para a URL do app para voltar à tela de registro
|
||||
const isTauri = typeof window !== "undefined" && Boolean((window as typeof window & { __TAURI__?: unknown }).__TAURI__)
|
||||
if (isTauri) {
|
||||
// URL do app Tauri - em producao usa tauri.localhost, em dev usa localhost:1420
|
||||
const isDev = process.env.NODE_ENV === "development"
|
||||
const tauriUrl = isDev ? "http://localhost:1420/" : "http://tauri.localhost/"
|
||||
console.log("[PortalShell] Detectado ambiente Tauri, navegando para:", tauriUrl)
|
||||
window.location.href = tauriUrl
|
||||
return
|
||||
}
|
||||
router.replace("/login")
|
||||
}, [router])
|
||||
toast.error("Este dispositivo foi resetado. Reprovisione para continuar.")
|
||||
// Sessão "machine" existe apenas no fluxo do desktop; ao revogar o token, voltamos ao onboarding do app.
|
||||
const isDev = process.env.NODE_ENV === "development"
|
||||
const tauriUrl = isDev ? "http://localhost:1420/" : "http://tauri.localhost/"
|
||||
console.log("[PortalShell] Redirecionando para o onboarding do desktop:", tauriUrl)
|
||||
window.location.href = tauriUrl
|
||||
}, [])
|
||||
|
||||
const { isActive: machineIsActive } = useMachineStateMonitor({
|
||||
machineId: machineContext?.machineId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue