This commit is contained in:
2026-05-31 18:00:43 +03:30
parent 98af7d639b
commit b241d12ff5
20 changed files with 939 additions and 797 deletions

View File

@@ -1,27 +1,26 @@
import React, { useState } from "react";
import {
Box,
Paper,
TextField,
Typography,
Button,
Container,
Stack,
} from "@mui/material";
import { Box, TextField, Typography, Button, Container } from "@mui/material";
import { useApplicantLogin } from "@/hooks/auth.hook";
import { toast } from "sonner";
import { handleAxiosError } from "@/core/utils";
import { useRouter } from "next/navigation";
export default function LoginLayout() {
const [nationalId, setNationalId] = useState("");
const router = useRouter();
const { mutateAsync, isPending } = useApplicantLogin();
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
try {
const { message } = await mutateAsync(nationalId);
toast.success(message);
await mutateAsync(nationalId);
if (isPending) {
toast.loading("در حال انتقال به فرم استخدامي");
}
router.push("/form");
} catch (error) {
toast.error("خطا رخ داده است");
console.log(error);
toast.error(handleAxiosError(error));
}
};
@@ -60,6 +59,7 @@ export default function LoginLayout() {
fullWidth
variant="contained"
size="large"
loading={isPending}
sx={{ py: 1.5, borderRadius: 2, fontSize: "1rem" }}
>
ورود به سامانه