Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
add strategy name to filter criteria (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
romanetar authored Jul 12, 2023
1 parent 98a29b4 commit ac885f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/actions/promocode-specification-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ export const resetPromoCodeSpecForm = () => (dispatch) => {
dispatch(createAction(RESET_PROMOCODE_SPEC_FORM)({}));
};

export const queryMultiSpeakersPromocodes = _.debounce(async (summitId, input, callback) => {
export const queryMultiSpeakersPromocodes = _.debounce(async (summitId, input, promoCodeStrategy, callback) => {

const accessToken = await getAccessTokenSafely();

input = escapeFilterValue(input);

const params = `filter[]=code=@${input}&filter[]=class_name==${SPEAKERS_PROMO_CODE_CLASS_NAME}||${SPEAKERS_DISCOUNT_CODE_CLASS_NAME}`;
const params = `filter[]=code=@${input}&filter[]=class_name==${promoCodeStrategy === 1 ? SPEAKERS_PROMO_CODE_CLASS_NAME : SPEAKERS_DISCOUNT_CODE_CLASS_NAME}`;

fetch(`${window.API_BASE_URL}/api/v1/summits/${summitId}/promo-codes?${params}&access_token=${accessToken}`)
.then(fetchResponseHandler)
Expand Down
4 changes: 3 additions & 1 deletion src/components/forms/speakers-promo-code-spec-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ class SpeakerPromoCodeSpecForm extends React.Component {
placeholder={promoCodeStrategy === 1 ?
T.translate("promo_code_specification.placeholders.speakers_promo_code") :
T.translate("promo_code_specification.placeholders.speakers_discount_code")}
customQueryAction={queryMultiSpeakersPromocodes}
customQueryAction={
(summitId, input, callback) => queryMultiSpeakersPromocodes(summitId, input, promoCodeStrategy, callback)
}
isClearable={true}
error={hasErrors('existingPromoCode', errors)}
/>
Expand Down

0 comments on commit ac885f4

Please sign in to comment.