mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-18 20:09:08 +02:00
21 lines
587 B
JavaScript
21 lines
587 B
JavaScript
|
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)));
|
||
|
}
|