fix error handling in ticket endpoint
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
89e046e093
commit
9f7b62cdff
5
main.js
5
main.js
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user