First version of dialog

This commit is contained in:
Deluan
2020-05-24 00:03:42 -04:00
committed by Deluan Quintão
parent 8973477fe5
commit 23bd5e1131
5 changed files with 201 additions and 28 deletions
+36
View File
@@ -0,0 +1,36 @@
const NEW_PLAYLIST_OPEN = 'NEW_PLAYLIST_OPEN'
const NEW_PLAYLIST_CLOSE = 'NEW_PLAYLIST_CLOSE'
const openNewPlaylist = (albumId, selectedIds) => ({
type: NEW_PLAYLIST_OPEN,
albumId,
selectedIds,
})
const closeNewPlaylist = () => ({
type: NEW_PLAYLIST_CLOSE,
})
const newPlaylistDialogReducer = (
previousState = {
open: false,
},
payload
) => {
const { type } = payload
switch (type) {
case NEW_PLAYLIST_OPEN:
return {
...previousState,
open: true,
albumId: payload.albumId,
selectedIds: payload.selectedIds,
}
case NEW_PLAYLIST_CLOSE:
return { ...previousState, open: false }
default:
return previousState
}
}
export { openNewPlaylist, closeNewPlaylist, newPlaylistDialogReducer }