member_webapp/@overflow/discovery/store/setting/setting.reducer.ts
crusader d59d9379f9 ing
2018-05-24 15:44:13 +09:00

49 lines
891 B
TypeScript

import {
Actions,
ActionType,
Setting,
} from './setting.action';
import {
State,
initialState,
} from './setting.state';
import { DiscoveryStartInfo } from '@overflow/commons-typescript/model/discovery';
export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.Setting: {
return {
...state,
error: null,
isPending: true,
};
}
case ActionType.SettingSuccess: {
return {
...state,
isStart: true,
error: null,
isPending: false,
discoveryStartInfo: action.payload,
};
}
case ActionType.SettingFailure: {
return {
...state,
isStart: false,
error: action.payload,
isPending: false,
discoveryStartInfo: null,
};
}
default: {
return state;
}
}
}