Skip to content

Commit

Permalink
fix: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
zeyu2001 committed Oct 2, 2024
1 parent 17d8daf commit ef2e2b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/utils/handleSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ export const handleSubmit = async (data: unknown) => {
window.location.href = '/success'
})
.catch(e => {
const err = e as AxiosError
if (err.response.data.name == 'ConditionalCheckFailedException') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const err = e as AxiosError<any, any>
if (err.response?.data?.name == 'ConditionalCheckFailedException') {
throw new Error(`You have already registered as ${result.data.Crsid}.`)
} else {
throw new Error('Server Err. ' + err.response.data)
throw new Error('Server error: ' + err.response ? err.response?.data : 'Please try again later.')
}
})
}

0 comments on commit ef2e2b2

Please sign in to comment.