create new playlist

This commit is contained in:
grimhilt 2023-08-01 19:00:17 +02:00
parent ca2262403b
commit 124e6dc894
2 changed files with 11 additions and 1 deletions

View File

@ -22,7 +22,7 @@ const Files = () => {
}
})
.catch((err) => {
setNotification(true, err.response.data.error);
setNotification(true, err.message);
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

View File

@ -3,6 +3,7 @@ import NavbarSignage from '../../components/navbar';
import PlaylistTable from './playlist-table';
import API from '../../services/api';
import setNotification from '../errors/error-notification';
import ModalCreatePlaylist from './create';
const Playlists = () => {
const [showCreate, setShowCreate] = useState(false);
@ -38,6 +39,10 @@ const Playlists = () => {
setPage((prev) => prev + limit);
};
const addPlaylist = (playlist) => {
setPlaylist((prev) => [...prev, playlist]);
};
const navbar = {
title: 'Playlists',
search: search,
@ -59,6 +64,11 @@ const Playlists = () => {
updateHandler={toggleModalUpdate}
loadMore={loadMore}
/>
<ModalCreatePlaylist
opened={showCreate}
handler={toggleModalCreate}
addPlaylist={(playlist) => addPlaylist(playlist)}
/>
</>
);
};