Skip to content

Commit

Permalink
Merge pull request dozoisch#53 from m-orsh/master
Browse files Browse the repository at this point in the history
add an accessor for widgetid
  • Loading branch information
dozoisch committed Aug 9, 2017
2 parents 8932900 + 4eab065 commit e5f6fd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/recaptcha-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ const globalName = "grecaptcha";
export default makeAsyncScriptLoader(ReCAPTCHA, URL, {
callbackName,
globalName,
exposeFuncs: ["getValue", "reset", "execute"],
exposeFuncs: ["getValue", "getWidgetId", "reset", "execute"],
});
7 changes: 7 additions & 0 deletions src/recaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export default class ReCAPTCHA extends React.Component {
return null;
}

getWidgetId() {
if (this.props.grecaptcha && this.state.widgetId !== undefined) {
return this.state.widgetId;
}
return null;
}

execute() {
const { grecaptcha } = this.props;
const { widgetId } = this.state;
Expand Down

0 comments on commit e5f6fd9

Please sign in to comment.