From c47c311ecd2a4874968e9b3c3acf2871ab2b53a1 Mon Sep 17 00:00:00 2001 From: Theis Gaedigk Date: Wed, 3 Sep 2025 13:11:03 +0200 Subject: [PATCH] fixed issue/bug: #7 --- backend/services/database.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/backend/services/database.js b/backend/services/database.js index d284d8a..8848eb9 100644 --- a/backend/services/database.js +++ b/backend/services/database.js @@ -87,11 +87,8 @@ export const getItemsFromDatabase = async (role) => { }; export const getLoansFromDatabase = async () => { - const [result] = await pool.query("SELECT * FROM loans;"); - if (result.length > 0) { - return { success: true, data: result }; - } - return { success: false }; + const [rows] = await pool.query("SELECT * FROM loans;"); + return { success: true, data: rows.length > 0 ? rows : null }; }; export const getUserLoansFromDatabase = async (username) => {