From aa13a6d5faa8c1f36f0bb2a2bae4b826cb7095fb Mon Sep 17 00:00:00 2001 From: Pierre <397503+bemble@users.noreply.github.com> Date: Mon, 13 May 2024 13:06:39 +0200 Subject: [PATCH] fix: fix clean downloaded messaging --- front/src/Main.tsx | 4 ++-- server/holerr/api/routers/actions.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/front/src/Main.tsx b/front/src/Main.tsx index 6252fcd..e492cd8 100644 --- a/front/src/Main.tsx +++ b/front/src/Main.tsx @@ -46,8 +46,8 @@ const Main = () => { dispatch(addDownload(data)); }); - useSocketMessage("downloads/delete", (data) => { - dispatch(removeDownload(data.id)); + useSocketMessage("downloads/delete", (data) => { + dispatch(removeDownload(data)); }); const classes = useAppStyles(); diff --git a/server/holerr/api/routers/actions.py b/server/holerr/api/routers/actions.py index 027343c..4a8a174 100644 --- a/server/holerr/api/routers/actions.py +++ b/server/holerr/api/routers/actions.py @@ -1,3 +1,4 @@ +from holerr.core.log import Log from holerr.core.db import db from holerr.database.repositories import DownloadRepository from holerr.core.exceptions import NotFoundException @@ -11,6 +12,8 @@ router = APIRouter(prefix="/actions") +log = Log.get_logger(__name__) + @router.post("/add_magnet", response_model=Download, tags=["Actions"]) async def add_magnet(magnet: Magnet): @@ -59,5 +62,5 @@ async def clean_downloaded(): session = db.new_session() cleaned = DownloadRepository(session).clean_downloaded() for download in cleaned: - manager.broadcast(Actions["DOWNLOADS_DELETE"], download) + await manager.broadcast(Actions["DOWNLOADS_DELETE"], download) return cleaned