/**
 * @description Reducer for changing music state.
 */

import * as ActionNames from '../actions/action-types';

/**
 * @description Change state of music.
 * @param {Object} state
 * @param {Object} action
 * @return {Object} state
 */
const music = (state, action) => {
  switch (action.type) {
    case ActionNames.ADD_MUSIC:
      return {
        id: action.id,
        songName: action.songName,
        albumName: action.albumName,
        artistName: action.artistName,
        filePath: action.filePath,
      };
    default:
      return state;
  }
};

/**
 * @description Make state of music list.
 * @param {Array} state
 * @param {Object} action
 * @return {Array}
 */
const musics = (state = [], action) => {
  switch (action.type) {
    case ActionNames.ADD_MUSIC:
      return [
        ...state,
        music(undefined, action),
      ];
    default:
      return state;
  }
};

export default musics;

@@ -270,86 +270,11 @@
  =%3E 
+(
 %7B%0A
-  switch (action.type) %7B%0A    case ActionNames.ADD_MUSIC:%0A      return %7B%0A    
     
@@ -292,20 +292,16 @@
 id,%0A    
-   
- 
 songName
@@ -315,28 +315,24 @@
 n.songName,%0A
-    
     albumNam
@@ -348,28 +348,24 @@
 .albumName,%0A
-    
     artistNa
@@ -387,20 +387,16 @@
 stName,%0A
-    
     file
@@ -422,55 +422,10 @@
 th,%0A
-      %7D;%0A    default:%0A      return state;%0A  %7D%0A
 %7D
+)
 ;%0A%0A/

remove not needed logic