initial docker setup
This commit is contained in:
27
frontend/src/actions/dashboard/dashboardActions.js
Normal file
27
frontend/src/actions/dashboard/dashboardActions.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import {API_SERVER} from '../../config';
|
||||
import HtmlClient from '../../helpers/HtmlClient';
|
||||
import {REQUEST_GADGETS, RECIEVE_GADGETS} from '../../constants/dashboardConstants';
|
||||
const htmlClient = new HtmlClient();
|
||||
|
||||
const requestGadgets = () => ({type: REQUEST_GADGETS});
|
||||
const recieveGadgets = (json) => ({
|
||||
type: RECIEVE_GADGETS,
|
||||
gadgets: json
|
||||
});
|
||||
|
||||
export const fetchGadgets = () => {
|
||||
return dispatch => {
|
||||
dispatch(requestGadgets());
|
||||
return htmlClient.fetch({
|
||||
url: `${API_SERVER}/dashboards/api/getMyDashboard`
|
||||
})
|
||||
.then(response => {
|
||||
if(response.data && response.data.gadgets){
|
||||
dispatch(recieveGadgets(response.data.gadgets))
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
htmlClient.onError(error, dispatch);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user