diff --git a/src/components/form/LookupInput.tsx b/src/components/form/LookupInput.tsx index c966268..521bfa8 100644 --- a/src/components/form/LookupInput.tsx +++ b/src/components/form/LookupInput.tsx @@ -8,6 +8,7 @@ import { CheckIcon, ChevronUpDownIcon, MagnifyingGlassIcon, + ArrowPathIcon, } from "@heroicons/react/20/solid"; import { Listbox, Transition } from "@headlessui/react"; import clsx from "clsx"; @@ -89,10 +90,17 @@ const LookupInput: FunctionComponent = ({ const searchIcon = ( <>
-
); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 09ce04a..7b2f698 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -10,6 +10,7 @@ import ErrorCard from "@/components/common/ErrorCard"; const Index: NextPage = () => { const { error, setTarget, submit } = useLookup(); const [response, setResponse] = useState(); + const [isLoading, setLoading] = useState(false); return ( <> @@ -39,18 +40,23 @@ const Index: NextPage = () => {
{ setTarget(target); }} onSubmit={async function (props) { try { + setLoading(true); const result = await submit(props); if (result.isJust) setResponse(result.value); else setResponse(null); + setLoading(false); } catch (e) { setResponse(null); + setLoading(false); } }} />