Skip to content

Commit

Permalink
Throw an error in executeRecaptcha if siteKey is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
snelsi committed Jan 24, 2024
1 parent 322af73 commit 2a93268
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/useReCaptcha.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ const useReCaptcha = (reCaptchaKey?: string): useReCaptchaProps => {
throw new Error("Recaptcha has not been loaded");
}

if (!siteKey) {
throw new Error("ReCaptcha sitekey is not defined");
}

const result = await executeCaptchaRef.current(siteKey, { action });

return result;
Expand Down

0 comments on commit 2a93268

Please sign in to comment.