member_webapp/@overflow/probe/store/trash/modify/modify.reducer.ts
2018-05-24 19:50:43 +09:00

55 lines
938 B
TypeScript

import {
ActionType,
Actions,
} from './modify.action';
import {
State,
initialState,
} from './modify.state';
import { Probe } from '@overflow/commons-typescript/model/probe';
export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.Modify: {
return {
...state,
error: null,
isPending: true,
};
}
case ActionType.ModifySuccess: {
return {
...state,
error: null,
isPending: false,
modifiedProbe: action.payload,
};
}
case ActionType.ModifyFailure: {
return {
...state,
error: action.payload,
isPending: false,
modifiedProbe: null,
};
}
case ActionType.ModifyDisplayName: {
return {
...state,
error: null,
isPending: true,
};
}
default: {
return state;
}
}
}