import {actionPromise, gql} from "./index";





const actionOrder = (order) => {

    return async dispatch => {
        const queryJson = JSON.stringify(
            {
                order: 
                {orderGoods: order

                }}
        )

        await dispatch(actionPromise(`order`, gql(
            `mutation newOrder($order: OrderInput) {
                OrderUpsert(order: $order) {
                  _id
                  createdAt
                  total
                }
              }`,  queryJson
        )))
    }
}

export default actionOrder;
