Use useConfirmEmail hook in deep link verification flow (#9413)

* use useConfirmEmail hook in deep link verification flow

* more straightforward logic
This commit is contained in:
Samuel Newman
2025-11-20 17:48:13 +02:00
committed by GitHub
parent 002a63b125
commit f57268e9b8
2 changed files with 21 additions and 23 deletions
@@ -2,7 +2,10 @@ import {useMutation} from '@tanstack/react-query'
import {useAgent, useSession} from '#/state/session'
export function useConfirmEmail() {
export function useConfirmEmail({
onSuccess,
onError,
}: {onSuccess?: () => void; onError?: () => void} = {}) {
const agent = useAgent()
const {currentAccount} = useSession()
@@ -13,11 +16,13 @@ export function useConfirmEmail() {
}
await agent.com.atproto.server.confirmEmail({
email: currentAccount.email,
email: currentAccount.email.trim(),
token: token.trim(),
})
// will update session state at root of app
await agent.resumeSession(agent.session!)
},
onSuccess,
onError,
})
}