| 34 | } |
| 35 | |
| 36 | const listOrders = () => async (dispatch, getState) => { |
| 37 | |
| 38 | try { |
| 39 | dispatch({ type: ORDER_LIST_REQUEST }); |
| 40 | const { userSignin: { userInfo } } = getState(); |
| 41 | const { data } = await Axios.get("/api/orders", { |
| 42 | headers: |
| 43 | { Authorization: 'Bearer ' + userInfo.token } |
| 44 | }); |
| 45 | dispatch({ type: ORDER_LIST_SUCCESS, payload: data }) |
| 46 | } catch (error) { |
| 47 | dispatch({ type: ORDER_LIST_FAIL, payload: error.message }); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | const detailsOrder = (orderId) => async (dispatch, getState) => { |
| 52 | try { |