bigbuffet-rw/app/gabsocial/actions/patron.js
2020-04-14 15:45:38 -05:00

29 lines
679 B
JavaScript

import api from '../api';
export const PATRON_FUNDING_IMPORT = 'PATRON_FUNDING_IMPORT';
export const PATRON_FUNDING_FETCH_FAIL = 'PATRON_FUNDING_FETCH_FAIL';
export function fetchFunding() {
return (dispatch, getState) => {
api(getState).get('/patron/v1/funding').then(response => {
dispatch(importFetchedFunding(response.data));
}).catch(error => {
dispatch(fetchFundingFail(error));
});
};
};
export function importFetchedFunding(funding) {
return {
type: PATRON_FUNDING_IMPORT,
funding,
};
}
export function fetchFundingFail(error) {
return {
type: PATRON_FUNDING_FETCH_FAIL,
error,
skipAlert: true,
};
};