import AudioPlayer from 'site/audio/audio.player' import * as types from 'site/types' const initialState = { player: new AudioPlayer(), muted: false, } export default function audioReducer(state = initialState, action) { // console.log(action.type, action) switch (action.type) { case types.site.loaded: state.player.load(action.data.graph) return state case types.site.mute_audio: state.player.toggleMuted(true) return { ...state, muted: true, } case types.site.unmute_audio: state.player.toggleMuted(false) return { ...state, muted: false, } default: return state } }