refactor(sql): improved the return function to show data [] when not connected, prevents crashes
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user