diff --git a/controller/thymis_controller/routers/api.py b/controller/thymis_controller/routers/api.py index 7c1ffb0b..68052975 100644 --- a/controller/thymis_controller/routers/api.py +++ b/controller/thymis_controller/routers/api.py @@ -65,12 +65,11 @@ async def build_download_image( @router.post("/action/restart-device") -def deploy( +async def restart_device( identifier: str, - background_tasks: BackgroundTasks, project: project.Project = Depends(get_project), ): - background_tasks.add_task(project.create_restart_device_task(identifier)) + await project.create_restart_device_task(identifier) @router.get("/download-image") diff --git a/frontend/src/routes/devices/+page.svelte b/frontend/src/routes/devices/+page.svelte index ee7f7543..1460d4c2 100644 --- a/frontend/src/routes/devices/+page.svelte +++ b/frontend/src/routes/devices/+page.svelte @@ -33,12 +33,7 @@ } function restartDevice(device: Device) { - fetch( - `${controllerProtocol}://${controllerHost}/action/restart-device?identifier=${device.identifier}`, - { - method: 'POST' - } - ); + fetch(`/api/action/restart-device?identifier=${device.identifier}`, { method: 'POST' }); } const downloadUri = (uri: string) => {