feat: integrate navigation to log page upon successful account validation in CheckInOutManagement

This commit is contained in:
Md Asif 2024-12-24 00:18:32 +05:30
parent bd461995c7
commit f7fea99f30

View File

@ -9,6 +9,7 @@ import Notification from "../components/Notification";
import { useToast } from "../hooks/useToast";
import { lockerService } from "../services/locker.service";
import { useLoading } from "../hooks/useLoading";
import { useNavigate } from "react-router-dom";
function CheckInOutManagement() {
const [accountNumber, setAccountNumber] = useState("");
@ -20,6 +21,7 @@ function CheckInOutManagement() {
const showToast = useToast();
const { setIsLoading } = useLoading();
const navigate = useNavigate();
const handleNext = async (e) => {
e.preventDefault();
@ -34,11 +36,7 @@ function CheckInOutManagement() {
if (response.status === 200) {
const data = response.data;
if (data.code === 1) {
setNotification({
visible: true,
message: "Account is valid. Please proceed to the next step.",
type: "success",
});
navigate("log", { state: { accountNumber } });
} else if (data.code === 2) {
setNotification({
visible: true,