在 post api 中传递多个值?

pass the multiple value in post api?

这是我的 post api 请求,我需要来自前端的数据:

考虑下面的代码,users_id 实际上是从 localStorage 获取的,而 items_id 是从另一个 api 获取的,我从 componentDidMount 调用它:

purchaseOrder(){
        const Users_id = localStorage.getItem('id'); // get user_id
        const items_id = this.state.data.id; // get items_id
        console.log(Users_id)
        console.log(items_id)
        PostData('api/purchase-order-item/submit', this.state).then ((result) => {  // how to pass the users id and items id to api?
            let responseJSON = result;
            console.log(responseJSON);
            console.log(this.state)
            });
    }

this.state :

constructor(props){
  super(props);

   this.state ={
      data: [],
      remark: '', //for api 
      quantity: '', // for api
      isLoaded: false,
      redirect: false,
      history: PropTypes.object.isRequired
   }
    this.purchaseOrder = this.purchaseOrder.bind(this);
     this.onChange = this.onChange.bind(this);
 }

首先从状态中获取 remarkquantity 然后传递一个新的普通对象作为 API post 数据:

const users_id = localStorage.getItem('id'); // get user_id
const items_id = this.state.data.id; // get items_id
const { remark, quantity } = this.state;
PostData('api/purchase-order-item/submit', { remark, quantity, users_id, items_id }).then ((result) => {