fcc-challenges/drum-machine-react/src/reducers/isMetronomeReducer.js

19 lines
432 B
JavaScript

import { padsArray,initialIsMetronome } from "../Globals";
const getIsMetronomeStatuses = () => {
const metronomeStatuses = {};
padsArray.forEach(key => {
metronomeStatuses[key + 'isMetronome'] = sessionStorage.getItem(key + 'isMetronome');
});
return metronomeStatuses;
}
export default (state, action) => {
initialIsMetronome();
switch (action.type) {
default:
return getIsMetronomeStatuses();
}
};