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

18 lines
345 B
TypeScript
Raw Normal View History

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