just-paja/radio-drama-queen

View on GitHub
src/soundGallery/reducers/soundGalleryTarget.js

Summary

Maintainability
A
0 mins
Test Coverage
import { handleActions } from 'redux-actions'
import { replaceState } from 'react-saga-rest'

import { galleryTarget } from '../actions'

const initialState = {
  board: null,
  category: null
}

const soundGalleryTarget = handleActions({
  [galleryTarget.SET]: (state, action) => ({
    board: action.payload.board,
    category: action.payload.category
  }),
  [galleryTarget.CLEAR]: replaceState(initialState)
}, initialState)

export default soundGalleryTarget