Skip to content

Commit

Permalink
ensure primary on get write
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Sep 21, 2023
1 parent cdccc02 commit 9faf3d0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/routes/_auth+/verify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
} from './login.tsx'
import { handleVerification as handleOnboardingVerification } from './onboarding.tsx'
import { handleVerification as handleResetPasswordVerification } from './reset-password.tsx'
import { ensurePrimary } from '#app/utils/litefs.server.ts'

export const codeQueryParam = 'code'
export const targetQueryParam = 'target'
Expand Down Expand Up @@ -202,6 +203,10 @@ async function validateRequest(
return json({ status: 'error', submission } as const, { status: 400 })
}

// this code path could be part of a loader (GET request), so we need to make
// sure we're running on primary because we're about to make writes.
await ensurePrimary()

const { value: submissionValue } = submission

async function deleteVerification() {
Expand Down

0 comments on commit 9faf3d0

Please sign in to comment.