1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/store/application/actions.js

21 lines
587 B
JavaScript
Raw Normal View History

2016-12-03 15:54:15 +01:00
import api from '../../data/applications-api';
export const RECEIVE_APPLICATINS = 'RECEIVE_APPLICATINS';
export const ERROR_RECEIVE_APPLICATINS = 'ERROR_RECEIVE_APPLICATINS';
const recieveApplications = (json) => ({
type: RECEIVE_APPLICATINS,
value: json,
});
const errorReceiveApplications = (statusCode) => ({
type: ERROR_RECEIVE_APPLICATINS,
statusCode,
});
export function fetchApplications () {
return dispatch => api.fetchAll()
.then(json => dispatch(recieveApplications(json)))
.catch(error => dispatch(errorReceiveApplications(error)));
}