"use client"; import { useState } from "react"; import { Box, Button, TextField, Paper } from "@mui/material"; import { handleAxiosError } from "@/core/utils"; import { toast } from "react-toastify"; import { useRouter } from "next/navigation"; import { loginUser } from "@/services/api/auth.api"; export default function LoginForm() { const [showPassword, setShowPassword] = useState(false); const router = useRouter(); const [form, setForm] = useState({ username: "", password: "", }); const handleChange = (e: React.ChangeEvent) => { setForm({ ...form, [e.target.name]: e.target.value, }); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); try { const { message } = await loginUser(form); toast.success(message); router.push("/"); } catch (error) { toast.error(handleAxiosError(error)); } }; return (
ورود به سيستم ثبت تيكت ها
// // // ), // }} sx={{ mb: 2, "& .MuiOutlinedInput-root": { borderRadius: 3, background: "#f9fbff", "& fieldset": { borderColor: "#dbeafe", }, "&:hover fieldset": { borderColor: "#90caf9", }, "&.Mui-focused fieldset": { borderColor: "#1976d2", borderWidth: "2px", }, }, }} /> // // // ), // endAdornment: ( // // setShowPassword(!showPassword)}> // {showPassword ? : } // // // ), // }} sx={{ mb: 3, "& .MuiOutlinedInput-root": { borderRadius: 3, background: "#f9fbff", "& fieldset": { borderColor: "#dbeafe", }, "&:hover fieldset": { borderColor: "#90caf9", }, "&.Mui-focused fieldset": { borderColor: "#1976d2", borderWidth: "2px", }, }, }} />
); }