Le formatting fixes
This commit is contained in:
@ -12,17 +12,17 @@ import {
|
||||
Text,
|
||||
Textarea,
|
||||
useToast,
|
||||
VStack
|
||||
VStack,
|
||||
} from "@chakra-ui/react";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function(props: {
|
||||
export default function (props: {
|
||||
departments: string[];
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const [departments, setDepartments] = useState([] as string[]);
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [loading, setLoading] = useState(false);
|
||||
const toast = useToast();
|
||||
|
||||
function reset() {
|
||||
@ -34,20 +34,20 @@ export default function(props: {
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
setLoading(true)
|
||||
setLoading(true);
|
||||
const start = (document.getElementById("start") as HTMLInputElement).value;
|
||||
const end = (document.getElementById("start") as HTMLInputElement).value;
|
||||
const reason = (document.getElementById("reason") as HTMLTextAreaElement)
|
||||
.value;
|
||||
|
||||
if (!departments.length) {
|
||||
toast({
|
||||
title: 'Validation Error',
|
||||
description: 'You need to select at least one department',
|
||||
status: "error"
|
||||
})
|
||||
toast({
|
||||
title: "Validation Error",
|
||||
description: "You need to select at least one department",
|
||||
status: "error",
|
||||
});
|
||||
|
||||
setLoading(false)
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -56,22 +56,22 @@ export default function(props: {
|
||||
departments,
|
||||
end,
|
||||
reason,
|
||||
start
|
||||
start,
|
||||
}),
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
},
|
||||
method: "POST"
|
||||
method: "POST",
|
||||
});
|
||||
|
||||
if (!inactivityPost.ok) {
|
||||
setLoading(false)
|
||||
setLoading(false);
|
||||
toast({
|
||||
description: ((await inactivityPost.json()) as { error: string }).error,
|
||||
duration: 10000,
|
||||
isClosable: true,
|
||||
status: "error",
|
||||
title: "Error"
|
||||
title: "Error",
|
||||
});
|
||||
|
||||
return;
|
||||
@ -82,10 +82,10 @@ export default function(props: {
|
||||
duration: 10000,
|
||||
isClosable: true,
|
||||
status: "success",
|
||||
title: "Success"
|
||||
title: "Success",
|
||||
});
|
||||
|
||||
setLoading(true)
|
||||
setLoading(true);
|
||||
props.onClose();
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ export default function(props: {
|
||||
ml="8px"
|
||||
onClick={async () => await submit()}
|
||||
isLoading={loading}
|
||||
loadingText='Submitting...'
|
||||
loadingText="Submitting..."
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
|
Reference in New Issue
Block a user