fix error handling in ticket endpoint

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-05-15 22:00:46 +00:00
parent 89e046e093
commit 9f7b62cdff

View File

@ -43,6 +43,11 @@ app.post("/api/proxmox/*", async (req, res) => { // proxy endpoint for POST prox
app.post("/api/ticket", async (req, res) => { app.post("/api/ticket", async (req, res) => {
let response = await requestPVE("/access/ticket", "POST", null, JSON.stringify(req.body)); let response = await requestPVE("/access/ticket", "POST", null, JSON.stringify(req.body));
if (!response.ok) {
res.status(response.status).send({auth: false});
res.end();
return;
}
let ticket = response.data.data.ticket; let ticket = response.data.data.ticket;
let csrftoken = response.data.data.CSRFPreventionToken; let csrftoken = response.data.data.CSRFPreventionToken;
let username = response.data.data.username; let username = response.data.data.username;