import * as constants from './constants';
import { fromJS } from 'immutable';
import * as config from '../../../common/config.js';
import axios from '../../../common/axios_auth.js';

export const getLockstoreList = (pagination) =>{
    return(dispatch) =>{
        // console.log(config.CLD2API + '/contact/company')
        axios.get(config.CLD2API + '/contact/company', {
            params: {
                current: pagination.current,
                pageSize: pagination.pageSize,
                // sortField: sortField,
                // sort: sort,
                // searchValue:searchValue,
            },
        }).then((res) => {
            const data = res.data;
            if (data.code === 200) {
                // console.log(data.recordsTotal);
                dispatch({
                    type: constants.CHANGE_LOCKSTORE_DATA,
                    data: fromJS(data.data),
                    pagination: pagination,
                    recordsTotal:data.recordsTotal,
                    // searchValue:searchValue
                });
            } else {
                console.log(data);
            }
        }).catch((e) => {
            console.log(e);
            console.log('error');
        })
    }
}




    // current: pagination.current,    //当前页
    // pageSize: pagination.pageSize,  //每页多少条
    // sortField: sortField,           //排序字段
    // sort: sort,                     //按降序 升级
    // searchValue:searchValue         //检索关键字