27 lines
616 B
TypeScript
27 lines
616 B
TypeScript
|
import { ActionType, Actions } from './meta-probe-os.action';
|
||
|
import {
|
||
|
State,
|
||
|
initialState,
|
||
|
metaProbeOsEntityAdapter,
|
||
|
} from './meta-probe-os.state';
|
||
|
|
||
|
export function reducer(state: State = initialState, action: Actions): State {
|
||
|
switch (action.type) {
|
||
|
case ActionType.ReadAll: {
|
||
|
return {
|
||
|
...state,
|
||
|
};
|
||
|
}
|
||
|
case ActionType.ReadAllSuccess: {
|
||
|
return metaProbeOsEntityAdapter.setAll(action.payload, state);
|
||
|
}
|
||
|
case ActionType.ReadAllFailure: {
|
||
|
return metaProbeOsEntityAdapter.setError(action.payload, state);
|
||
|
}
|
||
|
|
||
|
default: {
|
||
|
return state;
|
||
|
}
|
||
|
}
|
||
|
}
|