fix(desktop): navega para URL do app Tauri ao resetar dispositivo
Some checks failed
CI/CD Web + Desktop / Deploy Convex functions (push) Blocked by required conditions
CI/CD Web + Desktop / Detect changes (push) Successful in 4s
CI/CD Web + Desktop / Deploy (VPS Linux) (push) Has been cancelled
Quality Checks / Lint, Test and Build (push) Has been cancelled
Some checks failed
CI/CD Web + Desktop / Deploy Convex functions (push) Blocked by required conditions
CI/CD Web + Desktop / Detect changes (push) Successful in 4s
CI/CD Web + Desktop / Deploy (VPS Linux) (push) Has been cancelled
Quality Checks / Lint, Test and Build (push) Has been cancelled
Usa getCurrentWebviewWindow().navigate() para voltar para a pagina inicial do app Tauri em vez de ir para o servidor web 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
649a270416
commit
d6531e2a4c
1 changed files with 12 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import { invoke } from "@tauri-apps/api/core"
|
|||
import { listen } from "@tauri-apps/api/event"
|
||||
import { Store } from "@tauri-apps/plugin-store"
|
||||
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 { ConvexReactClient } from "convex/react"
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs"
|
||||
|
|
@ -782,8 +783,17 @@ const handleTokenRevoked = useCallback(async () => {
|
|||
setCodeStatus(null)
|
||||
setCompanyName("")
|
||||
setError("Este dispositivo foi resetado. Informe o código de provisionamento para reconectar.")
|
||||
// Força recarregar a página inicial do app para sair de qualquer página web
|
||||
window.location.href = "/"
|
||||
// Força navegar de volta para a página inicial do app Tauri (não do servidor web)
|
||||
try {
|
||||
const webview = getCurrentWebviewWindow()
|
||||
// URL do app Tauri em produção é http://tauri.localhost/, em dev é http://localhost:1420/
|
||||
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])
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue