Skip to content

Commit

Permalink
fix(checkout): set window.culqi to a noop to avoid throwing on browser
Browse files Browse the repository at this point in the history
  • Loading branch information
klujanrosas committed Sep 17, 2018
1 parent 8113d83 commit 702d61d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class CulqiCheckout extends Component {
}

window.removeEventListener('message', this.onCulqiEvent, false);
window.culqi = undefined;
}

initCulqi = () => {
Expand All @@ -66,6 +67,8 @@ class CulqiCheckout extends Component {
requestAnimationFrame(() => {
this.setCulqiSettings(culqiSettings);
});
// Patch it so it doesn't throw on browser
window.culqi = () => {};
};

onCulqiLoad = e => {
Expand Down Expand Up @@ -127,7 +130,7 @@ class CulqiCheckout extends Component {

render() {
if (!this.props.publicKey) {
return 'Please pass along a `publicKey` prop.';
throw new Error('Please pass along a `publicKey` prop.');
}

return createElement(CulqiContext.Provider, {
Expand Down

0 comments on commit 702d61d

Please sign in to comment.