-
Notifications
You must be signed in to change notification settings - Fork 2
Add onError handler #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
it('does not call any callbacks when a string data passed in', async function () { | ||
const origin = $.anvilURL | ||
const data = { action: 'signerComplete' } | ||
const wrapper = $.render | ||
wrapper.instance().handleSignFinish({ origin, data }) | ||
expect($.handleLoad).not.to.have.been.called | ||
expect($.handleError).not.to.have.been.called | ||
expect($.handleFinish).not.to.have.been.called | ||
expect($.handleFinishSigning).not.to.have.been.called | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be does not call any callbacks when non-string data is passed in
I believe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
const payload = omit(parseURLParams(searchStr), IGNORED_KEYS) | ||
const hasError = payload.action === 'signerError' || payload.error || payload.errorType | ||
if (!payload.action) { | ||
payload.action = hasError ? 'signerError' : 'signerComplete' | ||
} | ||
if (hasError) { | ||
onError(payload) | ||
} else { | ||
searchObj = JSON.parse('{"' + decodeURI(searchStr).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}') | ||
hasError = searchObj.error || searchObj.errorType | ||
payload = { | ||
action: 'signerComplete', | ||
signerStatus: searchObj.signerStatus ?? null, | ||
signerEid: searchObj.signerEid ?? null, | ||
nextSignerEid: searchObj.nextSignerEid ?? null, | ||
documentGroupStatus: searchObj.documentGroupStatus ?? null, | ||
documentGroupEid: searchObj.documentGroupEid ?? null, | ||
etchPacketEid: searchObj.etchPacketEid ?? null, | ||
weldDataEid: searchObj.weldDataEid ?? null, | ||
} | ||
onFinishSigning(payload) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So much cleaner with the helpers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lookin good to me!
Adds an
onError
handler to both components. It will emit the following payloadThis PR also adds
Type of change