Skip to content

Commit

Permalink
better login error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtsam committed Jan 28, 2025
1 parent 373b7dd commit f8f3916
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/routes/_auth+/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getZodConstraint, parseWithZod } from '@conform-to/zod'
import { type SEOHandle } from '@nasa-gcn/remix-seo'
import { data, Form, useActionData, useSearchParams } from 'react-router'
import { HoneypotInputs } from 'remix-utils/honeypot/react'
import { z } from 'zod'
import { unknown, z } from 'zod'

Check warning on line 6 in app/routes/_auth+/login.tsx

View workflow job for this annotation

GitHub Actions / 🧶 ESLint

'unknown' is defined but never used. Allowed unused vars must match /^ignored/u

Check warning on line 6 in app/routes/_auth+/login.tsx

View workflow job for this annotation

GitHub Actions / 🧶 ESLint

'unknown' is defined but never used. Allowed unused vars must match /^ignored/u
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { Field } from '#app/components/forms.tsx'
import { StatusButton } from '#app/components/status-button.tsx'
Expand Down Expand Up @@ -65,7 +65,12 @@ export async function action({ request }: Route.ActionArgs) {
const authenticator = createAuthenticator(request)
const authHeaders = (await authenticator
.authenticate('email-link', request)
.catch((headers) => headers)) as Headers
.catch((unknown) => {
if (unknown instanceof Headers) {
return unknown
}
throw unknown
})) as Headers

const toastHeaders = await createToastHeaders({
title: '✨ Magic Link has been sent',
Expand Down

0 comments on commit f8f3916

Please sign in to comment.