This commit is contained in:
Deluan
2020-05-18 12:19:01 -04:00
parent cf019849f0
commit 84ea852339
+6 -8
View File
@@ -1,9 +1,5 @@
import React from 'react'
import {
useDataProvider,
useGetList,
useNotify,
} from 'react-admin'
import { useDataProvider, useGetList, useNotify } from 'react-admin'
import { MenuItem } from '@material-ui/core'
import PropTypes from 'prop-types'
@@ -25,7 +21,8 @@ export const addAlbumToPlaylist = (dataProvider, albumId, playlistId) =>
.then((response) => response.data.map((song) => song.id))
.then((ids) => addTracksToPlaylist(dataProvider, ids, playlistId))
const AddToPlaylistMenu = React.forwardRef(({ selectedIds, albumId, onClose }, ref) => {
const AddToPlaylistMenu = React.forwardRef(
({ selectedIds, albumId, onClose }, ref) => {
const notify = useNotify()
const dataProvider = useDataProvider()
const { ids, data, loaded } = useGetList(
@@ -49,7 +46,7 @@ const AddToPlaylistMenu = React.forwardRef(({ selectedIds, albumId, onClose }, r
add
.then((len) => {
notify('message.songsAddedToPlaylist', 'info', {smart_count: len})
notify('message.songsAddedToPlaylist', 'info', { smart_count: len })
})
.catch(() => {
notify('ra.page.error', 'warning')
@@ -68,7 +65,8 @@ const AddToPlaylistMenu = React.forwardRef(({ selectedIds, albumId, onClose }, r
))}
</>
)
})
}
)
AddToPlaylistMenu.propTypes = {
selectedIds: PropTypes.arrayOf(PropTypes.any).isRequired,