added eslint and prettier and formatted the whole codebase
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import FormBox from "../components/FormBox";
|
||||
import { useState } from "react";
|
||||
import FormField from "../components/FormField";
|
||||
import FormInput from "../components/FormInput";
|
||||
import { Search } from "lucide-react";
|
||||
import Button from "../components/Button";
|
||||
import { AnimatePresence } from "motion/react";
|
||||
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";
|
||||
import FieldsWrapper from "../components/FieldsWrapper";
|
||||
import FormBox from '../components/FormBox';
|
||||
import { useState } from 'react';
|
||||
import FormField from '../components/FormField';
|
||||
import FormInput from '../components/FormInput';
|
||||
import { Search } from 'lucide-react';
|
||||
import Button from '../components/Button';
|
||||
import { AnimatePresence } from 'motion/react';
|
||||
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';
|
||||
import FieldsWrapper from '../components/FieldsWrapper';
|
||||
|
||||
function CheckInOutManagement() {
|
||||
const [accountNumber, setAccountNumber] = useState("");
|
||||
const [notification, setNotification] = useState({ message: "", type: "" });
|
||||
const [accountNumber, setAccountNumber] = useState('');
|
||||
const [notification, setNotification] = useState({ message: '', type: '' });
|
||||
|
||||
const showToast = useToast();
|
||||
const { setIsLoading } = useLoading();
|
||||
@@ -22,8 +22,8 @@ function CheckInOutManagement() {
|
||||
|
||||
const handleNext = async (e) => {
|
||||
e.preventDefault();
|
||||
if (accountNumber === "") {
|
||||
showToast("Account Number is required", "error");
|
||||
if (accountNumber === '') {
|
||||
showToast('Account Number is required', 'error');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -33,26 +33,26 @@ function CheckInOutManagement() {
|
||||
if (response.status === 200) {
|
||||
const data = response.data;
|
||||
if (data.code === 1) {
|
||||
navigate("log", { state: { accountNumber } });
|
||||
navigate('log', { state: { accountNumber } });
|
||||
} else if (data.code === 2) {
|
||||
setNotification({
|
||||
visible: true,
|
||||
message:
|
||||
"Monthly access limit exceeded. A fine will be charged for each additional access.",
|
||||
type: "warning",
|
||||
'Monthly access limit exceeded. A fine will be charged for each additional access.',
|
||||
type: 'warning',
|
||||
});
|
||||
} else if (data.code === 3) {
|
||||
setNotification({
|
||||
visible: true,
|
||||
message:
|
||||
"Rent for this account is due. Please pay the rent amount in full to access the locker.",
|
||||
type: "error",
|
||||
'Rent for this account is due. Please pay the rent amount in full to access the locker.',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
setNotification(error.message, "error");
|
||||
setNotification(error.message, 'error');
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ function CheckInOutManagement() {
|
||||
return (
|
||||
<div>
|
||||
<AnimatePresence>
|
||||
{ notification.message !== "" && <Notification {...notification} /> }
|
||||
{notification.message !== '' && <Notification {...notification} />}
|
||||
</AnimatePresence>
|
||||
<FormBox title="Check In/Out">
|
||||
<FieldsWrapper>
|
||||
@@ -70,7 +70,7 @@ function CheckInOutManagement() {
|
||||
>
|
||||
<FormInput
|
||||
props={{
|
||||
type: "text",
|
||||
type: 'text',
|
||||
value: accountNumber,
|
||||
onChange: (e) => setAccountNumber(e.target.value),
|
||||
}}
|
||||
|
Reference in New Issue
Block a user