fix(desktop): corrige navegacao ao resetar dispositivo
All checks were successful
All checks were successful
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:
parent
d6531e2a4c
commit
826b376dd3
1 changed files with 3 additions and 11 deletions
|
|
@ -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(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue