feat: salta los tickets bloqueados

This commit is contained in:
Vicent Llopis 2023-01-05 14:54:43 +01:00
parent 1a74e84359
commit f356188491
1 changed files with 3 additions and 3 deletions

View File

@ -98,7 +98,7 @@ module.exports = Self => {
for (const ticketId of ticketsId) { for (const ticketId of ticketsId) {
try { try {
const lockCode = await getLockCode(token, secondCookie, ticketId); const lockCode = await getLockCode(token, secondCookie, ticketId);
if (lockCode == false) continue; if (!lockCode) throw new Error(`Can't get lock code`);
let form = new FormData(); let form = new FormData();
form.append('__CSRFToken__', token); form.append('__CSRFToken__', token);
form.append('id', ticketId); form.append('id', ticketId);
@ -123,7 +123,7 @@ module.exports = Self => {
} catch (e) { } catch (e) {
const err = new Error(`${ticketId} Ticket close failed: ${e.message}`); const err = new Error(`${ticketId} Ticket close failed: ${e.message}`);
err.stack += e.stack; err.stack += e.stack;
throw err; console.error(err);
} }
} }
} }
@ -141,7 +141,7 @@ module.exports = Self => {
const body = await response.text(); const body = await response.text();
const json = JSON.parse(body); const json = JSON.parse(body);
return json.code || json.retry; return json.code || null;
} }
}; };
}; };