added eslint and prettier and formatted the whole codebase
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { useState } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import FormBox from "../components/FormBox";
|
||||
import Button from "../components/Button";
|
||||
import Notification from "../components/Notification";
|
||||
import { lockerService } from "../services/locker.service";
|
||||
import { useToast } from "../hooks/useToast";
|
||||
import { useLoading } from "../hooks/useLoading";
|
||||
import { useState } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import FormBox from '../components/FormBox';
|
||||
import Button from '../components/Button';
|
||||
import Notification from '../components/Notification';
|
||||
import { lockerService } from '../services/locker.service';
|
||||
import { useToast } from '../hooks/useToast';
|
||||
import { useLoading } from '../hooks/useLoading';
|
||||
|
||||
function CheckInOutLog() {
|
||||
const [time, setTime] = useState(null);
|
||||
const [checkType, setCheckType] = useState("");
|
||||
const [notification, setNotification] = useState({ message: "", type: "" });
|
||||
const [checkType, setCheckType] = useState('');
|
||||
const [notification, setNotification] = useState({ message: '', type: '' });
|
||||
|
||||
const location = useLocation();
|
||||
const showToast = useToast();
|
||||
@@ -19,27 +19,23 @@ function CheckInOutLog() {
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
if (time === null || checkType === "") {
|
||||
showToast("Please fill in all fields", "error");
|
||||
if (time === null || checkType === '') {
|
||||
showToast('Please fill in all fields', 'error');
|
||||
return;
|
||||
}
|
||||
// Add your logic here
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await lockerService.checkInOut(
|
||||
accountNumber,
|
||||
time,
|
||||
checkType
|
||||
);
|
||||
const response = await lockerService.checkInOut(accountNumber, time, checkType);
|
||||
if (response.status === 200) {
|
||||
setNotification({ message: response.data.message, type: "success" });
|
||||
setNotification({ message: response.data.message, type: 'success' });
|
||||
} else {
|
||||
console.log(response);
|
||||
setNotification({ message: response.data.message, type: "error" });
|
||||
setNotification({ message: response.data.message, type: 'error' });
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
setNotification({ message: error.message, type: "error" });
|
||||
setNotification({ message: error.message, type: 'error' });
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
@@ -47,16 +43,14 @@ function CheckInOutLog() {
|
||||
|
||||
return (
|
||||
<div>
|
||||
{notification.message !== "" && <Notification {...notification} />}
|
||||
{notification.message !== '' && <Notification {...notification} />}
|
||||
<FormBox title="Check In/Out Log">
|
||||
<div className="px-4 pt-7 text-2xl font-display font-bold text-primary dark:text-primary-dark">
|
||||
{accountNumber}
|
||||
</div>
|
||||
<div className="p-2 pt-7 flex flex-col gap-4">
|
||||
<div className="flex">
|
||||
<label className="mr-4 text-lg text-black dark:text-primary-dark w-[10%]">
|
||||
Time
|
||||
</label>
|
||||
<label className="mr-4 text-lg text-black dark:text-primary-dark w-[10%]">Time</label>
|
||||
<input
|
||||
type="time"
|
||||
className="w-1/5 h-10 px-2 rounded-full dark:bg-grey dark:text-primary-dark border-2 focus:outline-grey border-grey text-black"
|
||||
|
Reference in New Issue
Block a user