From 5981fd5fec6d51309ec1430c751b55fed6d29a25 Mon Sep 17 00:00:00 2001 From: Yimin-Jin Date: Wed, 11 Sep 2024 10:05:13 +0800 Subject: [PATCH] fix: fix api-key template always return empty --- .../src/functions/repair.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/js/api-plugin-from-scratch-bearer/src/functions/repair.js b/templates/js/api-plugin-from-scratch-bearer/src/functions/repair.js index 856a379b60..88b431d335 100644 --- a/templates/js/api-plugin-from-scratch-bearer/src/functions/repair.js +++ b/templates/js/api-plugin-from-scratch-bearer/src/functions/repair.js @@ -22,11 +22,14 @@ async function repairs(req, context) { }; } + // Get the repair records from the data.json file. + const repairRecords = require("../repairsData.json"); + // Initialize response. const res = { status: 200, jsonBody: { - results: [], + results: repairRecords, }, }; @@ -38,9 +41,6 @@ async function repairs(req, context) { return res; } - // Get the repair records from the data.json file. - const repairRecords = require("../repairsData.json"); - // Filter the repair records by the assignedTo query parameter. const repairs = repairRecords.filter((item) => { const query = assignedTo.trim().toLowerCase();