Fix some http code

This commit is contained in:
SebClem 2024-07-22 11:20:10 +02:00
parent 2c03791db5
commit c4df879434
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
5 changed files with 8 additions and 16 deletions

View File

@ -13,8 +13,7 @@ actionRouter.post("/backup", (req, res) => {
.catch(() => {
logger.error("Something wrong !");
});
res.statusCode = 200;
res.send();
res.sendStatus(202);
});
export default actionRouter;

View File

@ -24,12 +24,10 @@ configRouter.put("/backup", (req, res) => {
validateBackupConfig(req.body as BackupConfig)
.then(() => {
saveBackupConfig(req.body as BackupConfig);
res.status(204);
res.send();
res.status(204).send();
})
.catch((error: ValidationError) => {
res.status(400);
res.json(error.details);
res.status(400).json(error.details);
});
});
@ -44,8 +42,7 @@ configRouter.put("/webdav", (req, res) => {
})
.then(() => {
saveWebdavConfig(req.body as WebdavConfig);
res.status(204);
res.send();
res.status(204).send();
})
.catch((error: ValidationError) => {
res.status(400);

View File

@ -14,8 +14,7 @@ homeAssistantRouter.get("/backups/", (req, res) => {
);
})
.catch((reason) => {
res.status(500);
res.json(reason);
res.status(500).json(reason);
});
});
@ -26,8 +25,7 @@ homeAssistantRouter.get("/backup/:slug", (req, res) => {
res.json(value.body.data);
})
.catch((reason) => {
res.status(500);
res.json(reason);
res.status(500).json(reason);
});
});
@ -38,8 +36,7 @@ homeAssistantRouter.get("/addons", (req, res) => {
res.json(value.body.data);
})
.catch((reason) => {
res.status(500);
res.json(reason);
res.status(500).json(reason);
});
});

View File

@ -11,7 +11,7 @@ messageRouter.patch("/:messageId/readed", (req, res) => {
if (messageManager.markReaded(req.params.messageId)) {
res.json(messageManager.get());
} else {
res.status(404).send();
res.sendStatus(404);
}
});

View File

@ -129,4 +129,3 @@ const { save, loading } = useConfigForm(
);
defineExpose({ save });
</script>
@/store/backupConfig