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(() => {
|
const handleTokenRevoked = useCallback(() => {
|
||||||
console.log("[PortalShell] Token foi revogado - redirecionando para tela de registro")
|
console.log("[PortalShell] Token foi revogado - redirecionando para tela de registro")
|
||||||
toast.error("Este dispositivo foi resetado. Faça login novamente.")
|
toast.error("Este dispositivo foi resetado. Reprovisione para continuar.")
|
||||||
// Se estiver rodando dentro do Tauri, navega para a URL do app para voltar à tela de registro
|
// Sessão "machine" existe apenas no fluxo do desktop; ao revogar o token, voltamos ao onboarding do app.
|
||||||
const isTauri = typeof window !== "undefined" && Boolean((window as typeof window & { __TAURI__?: unknown }).__TAURI__)
|
const isDev = process.env.NODE_ENV === "development"
|
||||||
if (isTauri) {
|
const tauriUrl = isDev ? "http://localhost:1420/" : "http://tauri.localhost/"
|
||||||
// URL do app Tauri - em producao usa tauri.localhost, em dev usa localhost:1420
|
console.log("[PortalShell] Redirecionando para o onboarding do desktop:", tauriUrl)
|
||||||
const isDev = process.env.NODE_ENV === "development"
|
window.location.href = tauriUrl
|
||||||
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])
|
|
||||||
|
|
||||||
const { isActive: machineIsActive } = useMachineStateMonitor({
|
const { isActive: machineIsActive } = useMachineStateMonitor({
|
||||||
machineId: machineContext?.machineId,
|
machineId: machineContext?.machineId,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue