feat: integrate navigation to log page upon successful account validation in CheckInOutManagement
This commit is contained in:
parent
bd461995c7
commit
f7fea99f30
@ -9,6 +9,7 @@ import Notification from "../components/Notification";
|
|||||||
import { useToast } from "../hooks/useToast";
|
import { useToast } from "../hooks/useToast";
|
||||||
import { lockerService } from "../services/locker.service";
|
import { lockerService } from "../services/locker.service";
|
||||||
import { useLoading } from "../hooks/useLoading";
|
import { useLoading } from "../hooks/useLoading";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
function CheckInOutManagement() {
|
function CheckInOutManagement() {
|
||||||
const [accountNumber, setAccountNumber] = useState("");
|
const [accountNumber, setAccountNumber] = useState("");
|
||||||
@ -20,6 +21,7 @@ function CheckInOutManagement() {
|
|||||||
|
|
||||||
const showToast = useToast();
|
const showToast = useToast();
|
||||||
const { setIsLoading } = useLoading();
|
const { setIsLoading } = useLoading();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const handleNext = async (e) => {
|
const handleNext = async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -34,11 +36,7 @@ function CheckInOutManagement() {
|
|||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
const data = response.data;
|
const data = response.data;
|
||||||
if (data.code === 1) {
|
if (data.code === 1) {
|
||||||
setNotification({
|
navigate("log", { state: { accountNumber } });
|
||||||
visible: true,
|
|
||||||
message: "Account is valid. Please proceed to the next step.",
|
|
||||||
type: "success",
|
|
||||||
});
|
|
||||||
} else if (data.code === 2) {
|
} else if (data.code === 2) {
|
||||||
setNotification({
|
setNotification({
|
||||||
visible: true,
|
visible: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user