diff --git a/demo/src/index.js b/demo/src/index.js index 2c5bd7c..2666106 100644 --- a/demo/src/index.js +++ b/demo/src/index.js @@ -23,6 +23,13 @@ class Demo extends React.Component { console.log(`${name} prop callback called for PSClickwrap with parameters: `, [...args]); }; + static onError = (...args) => { + if (args[0] === 'Command aborted on: validationTask, Error: missing_signer_id') { + alert('Please enter a signer ID (email address) before agreeing.'); + } + Demo.onEventMethod('onError', ...args); + }; + handleChangeSignerId = (e) => { this.setState({ signerIdValue: e.target.value }); }; @@ -61,13 +68,6 @@ class Demo extends React.Component { Demo.onEventMethod('onInvalid', ...args); }; - onError = (...args) => { - if (args[0] === 'Command aborted on: validationTask, Error: missing_signer_id') { - alert('Please enter a signer ID (email address) before agreeing.'); - } - Demo.onEventMethod('onError', ...args); - }; - onClickSubmit = () => { const { hasAgreed } = this.state; if (hasAgreed) { @@ -179,7 +179,7 @@ class Demo extends React.Component { onSent={(...args) => Demo.onEventMethod('onSent', ...args)} onInvalid={this.onInvalid} onDisplayed={(...args) => Demo.onEventMethod('onDisplayed', ...args)} - onError={this.onError} + onError={Demo.onError} onSetSignerId={this.onUpdateSignerId} onSet={(...args) => Demo.onEventMethod('onSet', ...args)} onRendered={(...args) => Demo.onEventMethod('onRendered', ...args)}