initial docker setup
This commit is contained in:
35
frontend/src/actions/dashboard/ordersActions.js
Normal file
35
frontend/src/actions/dashboard/ordersActions.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import {API_SERVER} from '../../config';
|
||||
import HtmlClient from '../../helpers/HtmlClient';
|
||||
import {
|
||||
REQUEST_ORDERS,
|
||||
RECEIVE_ORDERS
|
||||
} from '../../constants/dashboardConstants';
|
||||
const htmlClient = new HtmlClient();
|
||||
|
||||
export const requestOrders = () => ({
|
||||
type: REQUEST_ORDERS,
|
||||
isLoading: true
|
||||
});
|
||||
|
||||
export const recieveOrders = (json) => ({
|
||||
type: RECEIVE_ORDERS,
|
||||
isLoading: false,
|
||||
orders: json
|
||||
});
|
||||
|
||||
export const fetchOrders = (viewAllOrders) => {
|
||||
return dispatch => {
|
||||
dispatch(requestOrders());
|
||||
return htmlClient.fetch({
|
||||
url: `${API_SERVER}/dashboards/api/getOrderCentralInfo`,
|
||||
method: 'post',
|
||||
data: {
|
||||
viewAllOrders
|
||||
}
|
||||
})
|
||||
.then(response => dispatch(recieveOrders(response.data)))
|
||||
.catch(error => {
|
||||
htmlClient.onError(error, dispatch);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user