Use redux for ShareDialog

This commit is contained in:
Deluan
2023-01-24 13:04:00 -05:00
parent 17d9573f4d
commit 051e9c556d
9 changed files with 113 additions and 56 deletions
+31
View File
@@ -13,8 +13,39 @@ import {
EXTENDED_INFO_CLOSE,
LISTENBRAINZ_TOKEN_OPEN,
LISTENBRAINZ_TOKEN_CLOSE,
SHARE_MENU_OPEN,
SHARE_MENU_CLOSE,
} from '../actions'
export const shareDialogReducer = (
previousState = {
open: false,
ids: [],
resource: '',
name: '',
},
payload
) => {
const { type, ids, resource, name } = payload
switch (type) {
case SHARE_MENU_OPEN:
return {
...previousState,
open: true,
ids,
resource,
name,
}
case SHARE_MENU_CLOSE:
return {
...previousState,
open: false,
}
default:
return previousState
}
}
export const addToPlaylistDialogReducer = (
previousState = {
open: false,