custome.js 4.2 KB
import * as types from '../constants/ActionTypes';

const initialState = {
    customList:{},
    serverList:{},
    serverListCustom:{},
    serverListCustomSearch:{},
    custom:{},
    company:{},
    legalEntities:{},
    contacts:{},
    serverContractInfo:{},
    serverContractOwners:{},
    serverContractItems:{},
    formDefind     :[],
    adminDate      :'',
    is_fail        :'',
    add_custome_meg:'',
    recordList     :{},
    failRecordList :{},
    is_import      :'init',
    errorMeg       :'',
    remindSetting  :{},
    attachments    :[],
    customCommentsList:[],
    formBasicList: []
};

export default function environment(state = initialState,action) {
    switch(action.type) {
        case types.CUSTOM_LIST:
            return Object.assign({}, state, {
                customList: action.customList
            });
        case types.SERVER_LIST:
            return Object.assign({}, state, {
                serverList: action.serverList
            });
        case types.SERVER_LIST_CUSTOME:
            return Object.assign({}, state, {
                serverListCustom: action.serverListCustom
            });
        case types.SERVER_LIST_CUSTOME_SEARCH:
            return Object.assign({}, state, {
                serverListCustomSearch: action.serverListCustomSearch
            });
        case types.GET_CUSTOM:
            return Object.assign({}, state, {
                custom: action.custom
            });
        case types.GET_COMPANY_INFO:
            return Object.assign({}, state, {
                company: action.company
            });
        case types.LOAD_CUSTOMER_LEGAL_ENTITIES:
            return Object.assign({}, state, {
                legalEntities: action.legalEntities
            });
        case types.LOAD_CONTACTS_CUSTOMER:
            return Object.assign({}, state, {
                contacts: action.contacts
            });
        case types.LOAD_CONTACTS_OWNERS:
            return Object.assign({}, state, {
                owners: action.owners
            });
        case types.SERVER_CONTRACT_INFO:
            return Object.assign({}, state, {
                serverContractInfo: action.serverContractInfo
            });
        case types.SERVER_CONTRACT_OWNERS:
            return Object.assign({}, state, {
                serverContractOwners: action.serverContractOwners
            });
        case types.SERVER_CONTRACT_ITEMS:
            return Object.assign({}, state, {
                serverContractItems: action.serverContractItems
            });
        case types.LOAD_FORM_DEFIND:
            return Object.assign({}, state, {
                formDefind: action.formDefind
            });
        case types.LOAD_CONTACTS_ADMIN:
            return Object.assign({},state,{
                adminDate: action.adminDate
            });
        case types.ADD_FAIL:
            return Object.assign({},state,{
                is_fail        : action.is_fail,
                add_custome_meg: action.add_custome_meg,
            });
        case types.FAIL_RECORD_LIST:
                return Object.assign({},state,{
                    failRecordList: action.failRecordList
                });
        case types.GET_RECORD_LIST:
                return Object.assign({},state,{
                    recordList: action.recordList
                });
        case types.IMPORT_CUSTOMER:
                return Object.assign({},state,{
                    is_import: action.is_import,
                    errorMeg : action.errorMeg
                });
        case types.LOAD_REMIND_SETTING:
            return Object.assign({},state,{
                remindSetting        : action.remindSetting
            });
        case types.LOAD_ATTACHMENTS:
            return Object.assign({},state,{
                attachments        : action.attachments
            });
        case types.CUSTOM_COMMENTS_LIST:
            return Object.assign({},state,{
                customCommentsList        : action.customCommentsList
            });
        case types.LOAD_CRM_FORM_LIST:
            return Object.assign({},state,{
                formBasicList        : action.formBasicList
            });
        default:
            return state;
    }
}