From 124e6dc89471482c35b282fca7cb0bc5c305fb23 Mon Sep 17 00:00:00 2001 From: grimhilt Date: Tue, 1 Aug 2023 19:00:17 +0200 Subject: [PATCH] create new playlist --- src/pages/files/index.jsx | 2 +- src/pages/playlists/index.jsx | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pages/files/index.jsx b/src/pages/files/index.jsx index 93de7e5..09c1273 100644 --- a/src/pages/files/index.jsx +++ b/src/pages/files/index.jsx @@ -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 }, []); diff --git a/src/pages/playlists/index.jsx b/src/pages/playlists/index.jsx index 359f44e..3554368 100644 --- a/src/pages/playlists/index.jsx +++ b/src/pages/playlists/index.jsx @@ -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} /> + addPlaylist(playlist)} + /> ); };