import { LockKeyhole } from "lucide-react"; import { useState, type FormEvent } from "react"; import { Navigate } from "react-router"; import { useAuth } from "../auth/AuthContext"; import { useDeploymentProfile } from "../deployment/DeploymentProfileContext"; import { ApiError } from "../lib/api"; import { Button, ErrorBanner, Field, Input } from "../components/Ui"; import { AdminCopyright } from "../components/AdminCopyright"; export function LoginPage() { const { user, login } = useAuth(); const { profile, assetUrl } = useDeploymentProfile(); const [userName, setUserName] = useState(""); const [password, setPassword] = useState(""); const [busy, setBusy] = useState(false); const [error, setError] = useState(""); if (user) return ; async function submit(event: FormEvent) { event.preventDefault(); setBusy(true); setError(""); try { await login(userName, password); } catch (reason) { setError(reason instanceof ApiError ? reason.message : "ورود امکان‌پذیر نبود."); } finally { setBusy(false); } } return
{profile.company.displayName}/

{profile.company.displayName}

{profile.branding.applicationTitle}/

{profile.branding.adminTitle}

برای ادامه، اطلاعات حساب سامانه را وارد کنید.

{error && } setUserName(e.target.value)} required/> setPassword(e.target.value)} required/>
; }