refactor(sql): improved the return function to show data [] when not connected, prevents crashes

This commit is contained in:
2025-04-24 21:24:39 -05:00
parent 3573fd1a5b
commit ead63d4b41
36 changed files with 323 additions and 141 deletions

View File

@@ -25,10 +25,12 @@ export const standardOrders = async (data: any, user: any) => {
}
// order state
const { data: openOrders, error: oe } = await tryCatch(
const { data: o, error: oe } = await tryCatch(
query(orderState, "Gets the next 500 orders that have not been started")
);
const openOrders: any = o?.data;
if (oe) {
return {
sucess: false,
@@ -38,10 +40,10 @@ export const standardOrders = async (data: any, user: any) => {
}
// order state
const { data: i, error: ie } = await tryCatch(
const { data: invoice, error: ie } = await tryCatch(
query(invoiceAddress, "Gets invoices addresses")
);
const i: any = invoice?.data;
if (ie) {
return {
sucess: false,