Skip to content

Instantly share code, notes, and snippets.

@197291
Created October 26, 2017 07:03
Show Gist options
  • Save 197291/3b0780d96c48711f0570bad8ea82e001 to your computer and use it in GitHub Desktop.
Save 197291/3b0780d96c48711f0570bad8ea82e001 to your computer and use it in GitHub Desktop.
Actions
export function loadPlans(etag) {
return {
types: [LOAD_PLANS, LOAD_PLANS_SUCCESS, LOAD_PLANS_FAIL],
promise: (client) => client.get('/plans', {
headers: {
'If-None-Match': etag
}
})
};
}
export function create(data) {
return {
types: [CREATE, CREATE_SUCCESS, CREATE_FAIL],
promise: (client) => client.post('/payments', {
data
})
};
}
export function cancel(data) {
return {
types: [CANCEL, CANCEL_SUCCESS, CANCEL_FAIL],
promise: (client) => client.post('/payments/cancel', {
data
})
};
}
export function upgrade(plan) {
return {
types: [UPGRADE, UPGRADE_SUCCESS, UPGRADE_FAIL],
promise: (client) => client.put('/payments', {
data: {
plan
}
})
};
}
export function showCancelConfirm() {
return { type: SHOW_CANCEL_CONFIRM };
}
export function closeCancelConfirm() {
return { type: CLOSE_CANCEL_CONFIRM };
}
export function changeViwe(index) {
return { type: CHANGE_VIEW, index };
}
export function changePlan(planId) {
return { type: CHANGE_PLAN, planId };
}
export function changePlanItem(planItemId) {
return { type: CHANGE_PLAN_ITEM, planItemId };
}
export function errorCreateToken(errorMassage) {
return { type: ERROR_CREATE_TOKEN, errorMassage };
}
export function startCreateToken() {
return { type: START_CREATE_TOKEN };
}
export function cleanup() {
return { type: CLEANUP };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment