2018-04-06 11:02:18 +00:00
|
|
|
import {
|
|
|
|
Actions,
|
|
|
|
ActionType,
|
|
|
|
} from './regist.action';
|
|
|
|
|
|
|
|
import {
|
|
|
|
State,
|
|
|
|
initialState,
|
|
|
|
} from './regist.state';
|
|
|
|
|
2018-05-02 07:23:35 +00:00
|
|
|
import { DiscoveryStartInfo } from '@overflow/commons-typescript/model/discovery';
|
2018-04-06 11:02:18 +00:00
|
|
|
|
|
|
|
export function reducer(state = initialState, action: Actions): State {
|
|
|
|
switch (action.type) {
|
|
|
|
case ActionType.SaveAllTarget: {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
error: null,
|
|
|
|
isPending: true,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
case ActionType.SaveAllTargetSuccess: {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
error: null,
|
|
|
|
isPending: false,
|
|
|
|
isSuccess: action.payload,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
case ActionType.SaveAllTargetFailure: {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
error: action.payload,
|
|
|
|
isPending: false,
|
|
|
|
isSuccess: null,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
default: {
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|