member_webapp/@overflow/probe/store/modify/modify.reducer.ts
crusader d59d9379f9 ing
2018-05-24 15:44:13 +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;
}
}
}