member_webapp/@overflow/probe/store/trash/modify/modify.reducer.ts

55 lines
938 B
TypeScript
Raw Normal View History

2018-04-27 07:31:27 +00:00
import {
ActionType,
Actions,
} from './modify.action';
import {
State,
initialState,
} from './modify.state';
2018-05-02 08:09:39 +00:00
import { Probe } from '@overflow/commons-typescript/model/probe';
2018-04-27 07:31:27 +00:00
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,
2018-04-29 10:43:14 +00:00
modifiedProbe: action.payload,
2018-04-27 07:31:27 +00:00
};
}
case ActionType.ModifyFailure: {
return {
...state,
error: action.payload,
isPending: false,
2018-04-29 10:43:14 +00:00
modifiedProbe: null,
2018-04-27 07:31:27 +00:00
};
}
2018-05-02 03:59:45 +00:00
case ActionType.ModifyDisplayName: {
return {
...state,
error: null,
isPending: true,
};
}
2018-04-27 07:31:27 +00:00
default: {
return state;
}
}
}