Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Update events to not use array syntax
Browse files Browse the repository at this point in the history
This fixes the redirect bug
  • Loading branch information
vincemtnz committed Jun 21, 2018
1 parent 9e516b3 commit bee45b0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/javascript/components/ExpressDonation/ExpressDonation.js
Expand Up @@ -67,14 +67,14 @@ export class ExpressDonation extends Component {
}

async onSuccess(data: any): any {
ee.emit('fundraiser:transaction_success', [data, this.props.formData]);
ee.emit('fundraiser:transaction_success', data, this.props.formData);
return data;
}

async onFailure(reason: any): any {
this.setState({ submitting: false });
this.props.setSubmitting(false);
ee.emit('fundraiser:transaction_error', [reason, this.props.formData]);
ee.emit('fundraiser:transaction_error', reason, this.props.formData);
return reason;
}

Expand Down
11 changes: 6 additions & 5 deletions app/javascript/components/Payment/Payment.js
Expand Up @@ -266,10 +266,11 @@ export class Payment extends Component {
window.fbq('track', 'AddPaymentInfo', eventPayload);
}

ee.emit('fundraiser:transaction_submitted', [
ee.emit(
'fundraiser:transaction_submitted',
eventPayload,
this.props.formData,
]);
this.props.formData
);

$.post(
`/api/payment/braintree/pages/${this.props.page.id}/transaction`,
Expand All @@ -289,12 +290,12 @@ export class Payment extends Component {
: 'not_recurring',
});
}
ee.emit('fundraiser:transaction_success', [data, this.props.formData]);
ee.emit('fundraiser:transaction_success', data, this.props.formData);
this.setState({ errors: [] });
}

onError(reason: any) {
ee.emit('fundraiser:transaction_error', [reason, this.props.formData]);
ee.emit('fundraiser:transaction_error', reason, this.props.formData);
this.props.setSubmitting(false);
}

Expand Down
10 changes: 7 additions & 3 deletions app/javascript/member-facing/backbone/action_form.js
Expand Up @@ -173,9 +173,13 @@ const ActionForm = Backbone.View.extend({
},

selectizeDropdowns() {
$(this.$el)
.find('.action-form__country-selector, .action-form__dropdown')
.selectize();
try {
$(this.$el)
.find('.action-form__country-selector, .action-form__dropdown')
.selectize();
} catch (e) {
return;
}
},

clearFormErrors() {
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/state/fundraiser/actions.js
Expand Up @@ -4,12 +4,12 @@ import ee from '../../shared/pub_sub';
import type { FundraiserAction, PaymentType } from './types';

export function changeAmount(payload: ?number): FundraiserAction {
ee.emit('fundraiser:change_amount', [payload]);
ee.emit('fundraiser:change_amount', payload);
return { type: 'change_amount', payload };
}

export function changeCurrency(payload: string): FundraiserAction {
ee.emit('fundraiser:change_currency', [payload]);
ee.emit('fundraiser:change_currency', payload);
return { type: 'change_currency', payload };
}

Expand All @@ -19,7 +19,7 @@ export function setSubmitting(payload: boolean): FundraiserAction {

export function changeStep(payload: number): FundraiserAction {
// we put it in a timeout because otherwise the event is fired before the step has switched
setTimeout(() => ee.emit('fundraiser:change_step', [payload]), 100);
setTimeout(() => ee.emit('fundraiser:change_step', payload), 100);
return { type: 'change_step', payload };
}

Expand Down

0 comments on commit bee45b0

Please sign in to comment.