brutal-legends/src/reducers/sort-key.ts

18 lines
329 B
TypeScript
Raw Normal View History

2020-03-05 08:07:46 +01:00
import { SET_SORT_KEY } from "../actions";
2020-03-05 18:09:48 +01:00
type Action = {
2020-03-05 08:07:46 +01:00
type: string;
payload: {
key: string;
};
2020-03-05 18:09:48 +01:00
};
2020-03-05 08:07:46 +01:00
2020-03-05 18:09:48 +01:00
export default (state: string = "id", action: Action) => {
2020-03-05 08:07:46 +01:00
switch (action.type) {
case SET_SORT_KEY:
return action.payload.key;
default:
return state;
}
};