2025-06-09 11:13:05 +00:00
|
|
|
"use client"
|
|
|
|
|
|
|
|
import { useEffect, useState } from "react"
|
|
|
|
import { useRouter } from "next/navigation"
|
|
|
|
import LoginForm from "@/components/login-form"
|
|
|
|
|
2025-06-09 13:32:46 +00:00
|
|
|
export default function HomePage() {
|
2025-06-09 11:13:05 +00:00
|
|
|
const [isLoading, setIsLoading] = useState(true)
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const token = localStorage.getItem("access_token")
|
2025-06-09 13:32:46 +00:00
|
|
|
if (token) {
|
2025-06-09 11:13:05 +00:00
|
|
|
router.push("/dashboard")
|
|
|
|
} else {
|
|
|
|
setIsLoading(false)
|
|
|
|
}
|
|
|
|
}, [router])
|
|
|
|
|
|
|
|
if (isLoading) {
|
|
|
|
return (
|
|
|
|
<div className="min-h-screen flex items-center justify-center">
|
|
|
|
<div className="animate-spin rounded-full h-32 w-32 border-b-2 border-gray-900"></div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="min-h-screen bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8">
|
|
|
|
<div className="sm:mx-auto sm:w-full sm:max-w-md">
|
|
|
|
<h2 className="mt-6 text-center text-3xl font-extrabold text-gray-900">Sistema de Transcrição</h2>
|
|
|
|
<p className="mt-2 text-center text-sm text-gray-600">Faça login para acessar o dashboard</p>
|
|
|
|
</div>
|
|
|
|
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
|
|
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
|
|
|
|
<LoginForm />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|