mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-12 01:37:40 +02:00
Merge pull request #314 from R0m1k3/1.1
Improve filtering for suppliers based on DLC status
This commit is contained in:
1 file changed
+9
-1
+9
-1
@@ -211,8 +211,16 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
}
|
||||
|
||||
// Check if DLC filter is requested
|
||||
const dlcFilter = req.query.dlc === 'true';
|
||||
const suppliers = await storage.getSuppliers();
|
||||
res.json(suppliers);
|
||||
|
||||
// Filter suppliers for DLC enabled only if requested
|
||||
if (dlcFilter) {
|
||||
const dlcSuppliers = suppliers.filter(supplier => supplier.dlcEnabled === true);
|
||||
res.json(dlcSuppliers);
|
||||
} else {
|
||||
res.json(suppliers);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error fetching suppliers:", error);
|
||||
res.status(500).json({ message: "Failed to fetch suppliers" });
|
||||
|
||||
Reference in new issue
Block a user