Fix primary onSubmit invocation to properly use Maybe types

This commit is contained in:
2024-05-09 02:30:00 -05:00
parent 49832cf8e7
commit 86d4bc5d2e

View File

@@ -42,9 +42,13 @@ const Index: NextPage = () => {
onChange={({ target, targetType }) => {
setTarget(target);
}}
onSubmit={async (props) => {
onSubmit={async function (props) {
try {
setResponse(await submit(props));
const result = await submit(props);
if (result.isJust)
setResponse(result.value);
else
setResponse(null);
} catch (e) {
setResponse(null);
}