fix(lots errors): fixes to prevent crashes when sql server not connected
This commit is contained in:
@@ -18,6 +18,20 @@ export const assignedPrinters = async () => {
|
||||
data: lotError,
|
||||
};
|
||||
}
|
||||
|
||||
if (l.data.length === 0 && !l.data.sucess) {
|
||||
createLog(
|
||||
"error",
|
||||
"lst",
|
||||
"ocp",
|
||||
`There was an error getting the lots: ${l?.message}`
|
||||
);
|
||||
return {
|
||||
success: false,
|
||||
message: "Error getting lots",
|
||||
data: [],
|
||||
};
|
||||
}
|
||||
const { data: print, error: printerError } = await tryCatch(getPrinters());
|
||||
|
||||
if (printerError) {
|
||||
@@ -29,17 +43,11 @@ export const assignedPrinters = async () => {
|
||||
}
|
||||
|
||||
const printers: any = print.data ?? [];
|
||||
const lots: any = l.data.length === 0 ? [] : l.data;
|
||||
const lots: any = l?.data.length === 0 ? null : l?.data;
|
||||
|
||||
if (!lots) {
|
||||
createLog(
|
||||
"error",
|
||||
"lst",
|
||||
"ocp",
|
||||
`There was an error getting the lots: ${lots.message}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
//console.log(lots);
|
||||
|
||||
return;
|
||||
for (let i = 0; i < printers.length; i++) {
|
||||
// is the printer assinged in alplalabel online?
|
||||
const assigned = lots?.filter(
|
||||
|
||||
Reference in New Issue
Block a user