Skip to content

Commit 4eab065

Browse files
committed
lets try this, add an accessor for getwidgetid
1 parent 8932900 commit 4eab065

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/recaptcha-wrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ const globalName = "grecaptcha";
1111
export default makeAsyncScriptLoader(ReCAPTCHA, URL, {
1212
callbackName,
1313
globalName,
14-
exposeFuncs: ["getValue", "reset", "execute"],
14+
exposeFuncs: ["getValue", "getWidgetId", "reset", "execute"],
1515
});

src/recaptcha.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ export default class ReCAPTCHA extends React.Component {
1616
return null;
1717
}
1818

19+
getWidgetId() {
20+
if (this.props.grecaptcha && this.state.widgetId !== undefined) {
21+
return this.state.widgetId;
22+
}
23+
return null;
24+
}
25+
1926
execute() {
2027
const { grecaptcha } = this.props;
2128
const { widgetId } = this.state;

0 commit comments

Comments
 (0)