Skip to content

Commit 4e56ffe

Browse files
committed
Call startWebauthnUserRegistration auth helper from passkey modal
1 parent 6c8f205 commit 4e56ffe

File tree

1 file changed

+9
-2
lines changed
  • packages/template-retail-react-app/app/components/passkey-registration-modal

1 file changed

+9
-2
lines changed

packages/template-retail-react-app/app/components/passkey-registration-modal/index.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const PasskeyRegistrationModal = ({isOpen, onClose}) => {
5353
const commerceApiConfig = config.app.commerceAPI
5454
const webauthnConfig = config.app.login.passkey
5555
const authorizeWebauthnRegistration = useAuthHelper(AuthHelpers.AuthorizeWebauthnRegistration)
56+
const startWebauthnUserRegistration = useAuthHelper(AuthHelpers.StartWebauthnUserRegistration)
5657

5758
const handleRegisterPasskey = async () => {
5859
setIsLoading(true)
@@ -80,8 +81,14 @@ const PasskeyRegistrationModal = ({isOpen, onClose}) => {
8081
}
8182

8283
const handleOtpVerification = async (code) => {
83-
// TODO: Implement OTP verification
84-
return {success: true}
84+
try {
85+
await startWebauthnUserRegistration.mutateAsync({
86+
user_id: customer.email,
87+
pwd_action_token: code
88+
})
89+
} catch (err) {
90+
setError(err.message || 'Failed to start webauthn user registration')
91+
}
8592
}
8693

8794
const resetState = () => {

0 commit comments

Comments
 (0)