Files
sgeUpdated/src/redux/reducers/datas/index.js

59 lines
1.3 KiB
JavaScript

const initialState = {
sectors: [],
sector: [],
subSectors: [],
subSector: [],
activitySubUnits: [],
consuptionUnits: [],
emissionScopes: [],
gpcReferences: [],
mcfTypes: [],
};
const datasReducer = (state = initialState, action) => {
switch (action.type) {
case "GET_SECTORS":
return {
...state,
sectors: action.payload.sectors,
};
case "GET_SECTOR_BY_ID":
return {
...state,
sector: action.payload.sector,
};
case "GET_SUBSECTORS":
return {
...state,
subSectors: action.payload.subSectors,
};
case "GET_SUBSECTOR_BY_ID":
return {
...state,
subSector: action.payload.subSector || {},
};
case "GET_ACTIVITY_SUBUNITS":
return {
...state,
activitySubUnits: action.payload.activitySubUnits,
};
case "GET_CONSUPTION_UNITS":
return {
...state,
consuptionUnits: action.payload.consuptionUnits,
};
case "GET_GPC_REFERENCES":
return {
...state,
gpcReferences: action.payload.gpcReferences,
};
case "GET_MCF_TYPES":
return {
...state,
mcfTypes: action.payload.mcfTypes,
};
}
return state;
};
export default datasReducer;