mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
25 lines
469 B
Swift
25 lines
469 B
Swift
//
|
|
// PlaylistReducer.swift
|
|
// Persephone
|
|
//
|
|
// Created by Dan Barber on 2020-4-25.
|
|
// Copyright © 2020 Dan Barber. All rights reserved.
|
|
//
|
|
|
|
import ReSwift
|
|
|
|
func playlistReducer(action: Action, state: PlaylistState?) -> PlaylistState {
|
|
var state = state ?? PlaylistState()
|
|
|
|
switch action {
|
|
case let action as UpdatePlaylistsAction:
|
|
state.playlists = action.playlists.map { Playlist(mpdPlaylist: $0) }
|
|
|
|
default:
|
|
break
|
|
|
|
}
|
|
|
|
return state
|
|
}
|