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