1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00
unleash.unleash/frontend/src/store/e-admin-invoice/actions.js
Ivar Conradi Østhus 998cdf98ab feat: Add admin-invoice section (#299)
* feat: Add admin-invoice section

* fix: do not show invoice table if list is empty
2021-05-21 08:56:22 +02:00

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));
}