import fetch from 'isomorphic-fetch'
let domain1 = ENV.domain;
let domain = 'http://192.168.10.128:8080/web/'
//提交遗留上报的商品


const  submitBreakageProduct = (data)=>{
    console.log(data,"执行了提交遗留上报")
    let {productDetail,commonInfo}=data;
    let userId=commonInfo.userInfo.id;
    let machineId=commonInfo.storeInfo.id;
    let taskId=commonInfo.taskInfo.taskId;
    let {skuPosition,skuId,skuStatus}=productDetail;
    let bodyData={skuPosition,skuId,skuStatus,machineId,taskId}
    let url=domain+`flat/lr/${userId}`
    return ()=>{
        fetch(url,{
            // credentials : 'include',
            method : 'POST',
            mode : 'cors',
            headers:{
                'Access-Control-Allow-Origin': '*',
                'Content-Type': 'application/json; charset=UTF-8'
            },
            body:JSON.stringify(bodyData)
        }).then((response)=>response.json())
          .then((json)=>{
              console.log(json)
          })
  }
}

export {submitBreakageProduct}