36 lines
609 B
JavaScript
36 lines
609 B
JavaScript
import { combineReducers } from "redux";
|
|
|
|
const songReducer = () => {
|
|
return [
|
|
{
|
|
title: "No Scrubs",
|
|
duration: "4:05"
|
|
},
|
|
{
|
|
title: "Macarena",
|
|
duration: "2:30"
|
|
},
|
|
{
|
|
title: "All star",
|
|
duration: "4:45"
|
|
},
|
|
{
|
|
title: "I want it that way",
|
|
duration: "2:10"
|
|
}
|
|
];
|
|
};
|
|
|
|
const selectedSongReducer = (selectedSong = null, action) => {
|
|
if (action.type === "SONG_SELECTED") {
|
|
return action.payload;
|
|
}
|
|
|
|
return selectedSong;
|
|
};
|
|
|
|
export default combineReducers({
|
|
songs: songReducer,
|
|
selectedSongReducer: selectedSongReducer
|
|
});
|