import fetch from 'isomorphic-fetch';
import * as actionTypes from '../actiontype/otherQuestion';
const domain = 'http://test.mjitech.com';
const fakeJsonData = {
    "meta": {
        "code": "200",
        "message": "成功",
        "success": true
    },
    "data": {
        "feeds": [
            {
                "id": 6,
                "files": [
                    {
                        "id": 13,
                        "filePath": "http://static.mjitech.com/static/sku/0/0/2/1471329355724.jpg"
                    },
                    {
                        "id": 14,
                        "filePath": "http://static.mjitech.com/static/sku/0/0/425/1471329537289.jpg"
                    },
                    {
                        "id": 17,
                        "filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
                    }
                ],
                "parentProblemName": null,
                "subProblemName": null
            },
            {
                "id": 6,
                "files": [
                    /*{
                        "id": 13,
                        "filePath": "http://static.mjitech.com/static/sku/0/0/2/1471329355724.jpg"
                    },
                    {
                        "id": 14,
                        "filePath": "http://static.mjitech.com/static/sku/0/0/425/1471329537289.jpg"
                    },
                    {
                        "id": 17,
                        "filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
                    }*/
                ],
                "parentProblemName": null,
                "subProblemName": null
            }
        ],
        "employee": {
            "id": 5,
            "employeeName": "机器库管员",
            "headImageUrl": "/static/coupon/gounian/banner_hongbaotupian-3-14.jpg"
        },
        "warehouse": {
            "id": 13,
            "name": "华贸商业街",
            "image": "/tmp/2018-05-25/1527243213701.jpg"
        },
        "problems": [
            {
                "id": 18,
                "message": "机械故障",
                "type": "OP",
                "dicDetails": [
                    {
                        "messageId": 2,
                        "parentId": null,
                        "message": "fdffdfde3"
                    },
                    {
                        "messageId": 2,
                        "parentId": null,
                        "message": "55d5fdf"
                    },
                    {
                        "messageId": 2,
                        "parentId": null,
                        "message": "dfdf"
                    }
                ]
            },
            {
                "id": 19,
                "message": "下位机程序Bug",
                "type": "OP",
                "dicDetails": [
                    {
                        "messageId": 2,
                        "parentId": null,
                        "message": "其他问题89"
                    },
                    {
                        "messageId": 2,
                        "parentId": null,
                        "message": "dfdfdf"
                    },
                    {
                        "messageId": 2,
                        "parentId": null,
                        "message": "werer"
                    }
                ]
            }
        ]
    }
}
export function intGetOtherProblem(postData) {
    return (dispatch) => {
        /*let url = String(domain+'/web/machine_pad/list_other_fault.action');
        fetch(url,{
            credentials : 'include',
            method : 'POST',
            mode : 'cors',
            body : JSON.stringify(postData)

        }).then((response) => response.json())
            .then(
                (json)=>{
                    if(json.meta.is_succ){
                        initSuccess(json.data)
                    }else{
                    }
                }
            ).catch(e=>dispatch(console.log("出现错误"))
        )*/
        dispatch(initSuccess(fakeJsonData.data))
    }
}
function initSuccess(data) {
    return {
        type: actionTypes.INIT_GETNEWPROBLEM_SUCCESS,
        data
    }
}