MCPcopy Create free account
hub / github.com/basir/node-react-ecommerce / createOrder

Function createOrder

frontend/src/actions/orderActions.js:7–20  ·  view source on GitHub ↗
(order)

Source from the content-addressed store, hash-verified

5} from "../constants/orderConstants";
6
7const createOrder = (order) => async (dispatch, getState) => {
8 try {
9 dispatch({ type: ORDER_CREATE_REQUEST, payload: order });
10 const { userSignin: { userInfo } } = getState();
11 const { data: { data: newOrder } } = await Axios.post("/api/orders", order, {
12 headers: {
13 Authorization: ' Bearer ' + userInfo.token
14 }
15 });
16 dispatch({ type: ORDER_CREATE_SUCCESS, payload: newOrder });
17 } catch (error) {
18 dispatch({ type: ORDER_CREATE_FAIL, payload: error.message });
19 }
20}
21
22const listMyOrders = () => async (dispatch, getState) => {
23 try {

Callers 1

placeOrderHandlerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected