import * as constants from './constants';
import { fromJS } from 'immutable';

import axios from '../../../common/axios_auth.js';
// import axios from 'axios';



//actionType

export const getClientLIst = () => {
    return (dispatch) => {
        //axios.get(config.CLD2API+'/product/lock_store').then((res) => {
        axios.get('/api/lock_store.json').then((res) => {
            const data = res.data;
            
            if(data.code===200){
                
                let d2=data.data;
                //dispatch(changeList(JSON.parse(data.list)));
                // console.log(d2);
                dispatch({
                    type: constants.CHANGE_LOCKSTORE_DATA,
                    data: fromJS(d2),
                });
            }else{
                console.log(data);
            }
        }).catch((e) => {
            console.log(e);
            console.log('error');
        })
    }
};


const changeList = (data) => ({
    type: constants.CHANGE_LOCKSTORE_DATA,
    data: fromJS(data),
});
