mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-15 01:16:22 +02:00
20 lines
643 B
JavaScript
20 lines
643 B
JavaScript
import api from './api';
|
|
import { dispatchError } from '../util';
|
|
export const RECEIVE_INVOICES = 'RECEIVE_INVOICES';
|
|
export const ERROR_FETCH_INVOICES = 'ERROR_FETCH_INVOICES';
|
|
|
|
const debug = require('debug')('unleash:e-admin-invoice-actions');
|
|
|
|
export function fetchInvoices() {
|
|
debug('Start fetching invoices for hosted customer');
|
|
return dispatch =>
|
|
api
|
|
.fetchAll()
|
|
.then(value =>
|
|
dispatch({
|
|
type: RECEIVE_INVOICES,
|
|
invoices: value.invoices,
|
|
})
|
|
)
|
|
.catch(dispatchError(dispatch, ERROR_FETCH_INVOICES));
|
|
} |