fix(desktop): corrige navegacao ao resetar dispositivo
All checks were successful
CI/CD Web + Desktop / Detect changes (push) Successful in 5s
Quality Checks / Lint, Test and Build (push) Successful in 4m1s
CI/CD Web + Desktop / Deploy Convex functions (push) Has been skipped
CI/CD Web + Desktop / Deploy (VPS Linux) (push) Successful in 3m53s

Usa window.location.href com URL do Tauri em vez de API inexistente

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rever-tecnologia 2025-12-18 14:08:56 -03:00
parent d6531e2a4c
commit 826b376dd3

View file

@ -5,7 +5,6 @@ import { invoke } from "@tauri-apps/api/core"
import { listen } from "@tauri-apps/api/event" import { listen } from "@tauri-apps/api/event"
import { Store } from "@tauri-apps/plugin-store" import { Store } from "@tauri-apps/plugin-store"
import { appLocalDataDir, join } from "@tauri-apps/api/path" import { appLocalDataDir, join } from "@tauri-apps/api/path"
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"
import { ExternalLink, Eye, EyeOff, Loader2, RefreshCw } from "lucide-react" import { ExternalLink, Eye, EyeOff, Loader2, RefreshCw } from "lucide-react"
import { ConvexReactClient } from "convex/react" import { ConvexReactClient } from "convex/react"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs" import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs"
@ -784,16 +783,9 @@ const handleTokenRevoked = useCallback(async () => {
setCompanyName("") setCompanyName("")
setError("Este dispositivo foi resetado. Informe o código de provisionamento para reconectar.") setError("Este dispositivo foi resetado. Informe o código de provisionamento para reconectar.")
// Força navegar de volta para a página inicial do app Tauri (não do servidor web) // Força navegar de volta para a página inicial do app Tauri (não do servidor web)
try { // URL do app Tauri em produção é http://tauri.localhost/, em dev é http://localhost:1420/
const webview = getCurrentWebviewWindow() const appUrl = import.meta.env.MODE === "production" ? "http://tauri.localhost/" : "http://localhost:1420/"
// URL do app Tauri em produção é http://tauri.localhost/, em dev é http://localhost:1420/ window.location.href = appUrl
const appUrl = import.meta.env.MODE === "production" ? "http://tauri.localhost/" : "http://localhost:1420/"
await webview.navigate(appUrl)
} catch (err) {
console.error("Falha ao navegar para página inicial do app", err)
// Fallback: tenta recarregar a página
window.location.reload()
}
}, [store]) }, [store])
useEffect(() => { useEffect(() => {