brutal-legends/src/reducers/selected-album.ts
2020-03-05 20:14:09 +01:00

20 lines
437 B
TypeScript

import { SELECT_ALBUM, UNSELECT_ALBUM } from "../actions";
import { Album } from "../interfaces";
type Action = {
type: string;
payload: {
album: Album;
};
};
export default (state: Object = {}, action: Action) => {
switch (action.type) {
case SELECT_ALBUM:
return action.payload.album;
case UNSELECT_ALBUM:
return {};
default:
return state;
}
};