src/redux/reducers/playlists.js
/**
 * This function handles modifications to the "playlists" property of the overall state.
 *
 * @param state the current playlists data. Will be set to [] if it doesn't yet exist.
 * @param action the modification to make to the array
 * @returns the new playlists data
 */
This function handles modifications to the "playlists" property of the overall state.
@param state the current playlists data. Will be set to [] if it doesn't yet exist.
@param action the modification to make to the array
@returns the new playlists data
This function handles modifications to the " playlists " property of the overall state . @param state the current playlists data . Will be set to [] if it doesn ' t yet exist . @param action the modification to make to the array @returns the new playlists data
function playlists(state = [], action) {
  switch (action.type) {
    case GET_PLAYLISTDATA_LOADING:
      return playlists_LoadPlaylistsLoading(state, action);
    case GET_PLAYLISTDATA_SUCCESS:
      return playlists_LoadPlaylistsSuccess(state, action);
    case GET_PLAYLISTDATA_ERROR:
      return playlists_LoadPlaylistsError(state, action);
    case CREATE_PLAYLIST_LOADING:
      return playlists_CreatePlaylistLoading(state, action);
    case CREATE_PLAYLIST_SUCCESS:
      return playlists_CreatePlaylistSuccess(state, action);
    case CREATE_PLAYLIST_ERROR:
      return playlists_CreatePlaylistError(state, action);
    case SET_ACTIVE_PLAYLIST:
      return playlist_SetActivePlaylist(state, action);
    case GET_PLAYLIST_LOADING:
      return playlists_getPlaylistLoading(state, action);
    case GET_PLAYLIST_SUCCESS:
      return playlists_getPlaylistSuccess(state, action);
    case GET_PLAYLIST_ERROR:
      return playlists_getPlaylistError(state, action);
    case SET_COLLABORATIVE_LOADING:
      return playlists_setCollaborativeLoading(state, action);
    case SET_COLLABORATIVE_SUCCESS:
      return playlists_setCollaborativeSuccess(state, action);
    case SET_COLLABORATIVE_ERROR:
      return playlists_setCollaborativeError(state, action);
    case GET_ALLSESSIONS:
      return playlist_allSessions(state, action);
    default:
      return state;
  }
}
function playlists ( state = [ ] , action ) { switch ( action . type ) { case GET_PLAYLISTDATA_LOADING : return playlists_LoadPlaylistsLoading ( state , action ) ; case GET_PLAYLISTDATA_SUCCESS : return playlists_LoadPlaylistsSuccess ( state , action ) ; case GET_PLAYLISTDATA_ERROR : return playlists_LoadPlaylistsError ( state , action ) ; case CREATE_PLAYLIST_LOADING : return playlists_CreatePlaylistLoading ( state , action ) ; case CREATE_PLAYLIST_SUCCESS : return playlists_CreatePlaylistSuccess ( state , action ) ; case CREATE_PLAYLIST_ERROR : return playlists_CreatePlaylistError ( state , action ) ; case SET_ACTIVE_PLAYLIST : return playlist_SetActivePlaylist ( state , action ) ; case GET_PLAYLIST_LOADING : return playlists_getPlaylistLoading ( state , action ) ; case GET_PLAYLIST_SUCCESS : return playlists_getPlaylistSuccess ( state , action ) ; case GET_PLAYLIST_ERROR : return playlists_getPlaylistError ( state , action ) ; case SET_COLLABORATIVE_LOADING : return playlists_setCollaborativeLoading ( state , action ) ; case SET_COLLABORATIVE_SUCCESS : return playlists_setCollaborativeSuccess ( state , action ) ; case SET_COLLABORATIVE_ERROR : return playlists_setCollaborativeError ( state , action ) ; case GET_ALLSESSIONS : return playlist_allSessions ( state , action ) ; default : return state ; } }
This function handles modifications to the "playlists" property of the overall state.
This function handles modifications to the " playlists " property of the overall state .
// Perform different things based on the type of action //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~