Skip to content

Commit

Permalink
fix mistyping
Browse files Browse the repository at this point in the history
  • Loading branch information
fiskus committed Aug 26, 2022
1 parent d3803c2 commit 8022e5f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions catalog/app/components/Dialog/Prompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ function Dialog({
validate,
}: DialogProps) {
const [value, setValue] = React.useState(initialValue || '')
const [submited, setSubmited] = React.useState(false)
const [submitted, setSubmitted] = React.useState(false)
const error = React.useMemo(() => validate(value), [validate, value])
const handleChange = React.useCallback((event) => setValue(event.target.value), [])
const handleSubmit = React.useCallback(
(event) => {
event.preventDefault()
setSubmited(true)
setSubmitted(true)
if (!error) onSubmit(value)
},
[error, onSubmit, value],
Expand All @@ -44,7 +44,7 @@ function Dialog({
onChange={handleChange}
value={value}
/>
{!!error && !!submited && (
{!!error && !!submitted && (
<Lab.Alert severity="error">{error.message}</Lab.Alert>
)}
</M.DialogContent>
Expand All @@ -54,7 +54,7 @@ function Dialog({
</M.Button>
<M.Button
color="primary"
disabled={!!error && !!submited}
disabled={!!error && !!submitted}
onClick={handleSubmit}
variant="contained"
>
Expand Down

0 comments on commit 8022e5f

Please sign in to comment.