Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

fix: clean downloaded messaging #10

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions front/src/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const Main = () => {
dispatch(addDownload(data));
});

useSocketMessage<Download>("downloads/delete", (data) => {
dispatch(removeDownload(data.id));
useSocketMessage<string>("downloads/delete", (data) => {
dispatch(removeDownload(data));
});

const classes = useAppStyles();
Expand Down
5 changes: 4 additions & 1 deletion server/holerr/api/routers/actions.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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