From c717d2b79ad79625d2440399753513e5c1442e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincze=20J=C3=B3zsef?= Date: Wed, 19 Feb 2025 15:27:24 +0100 Subject: [PATCH] Android api asynced --- app.js | 16 ++++------------ routes/employee.js | 10 ++-------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/app.js b/app.js index a14dc7b..03ef46e 100644 --- a/app.js +++ b/app.js @@ -411,16 +411,8 @@ app.post('/apiRegisterDevice',function(req,res){ }) }) -app.get('/apiemployee/:apiKey',function(req,res){ - apiEmployee(req.params.apiKey,function(err,w){ - if (err) - { - res.setHeader('Content-Type', 'application/json'); - res.send(err); - - } - else - { +app.get('/apiemployee/:apiKey', async function(req,res){ + var w=await apiEmployee(req.params.apiKey)//,function(err,w){ if (w){ res.setHeader('Content-Type', 'application/json'); res.send(w); @@ -430,8 +422,8 @@ app.get('/apiemployee/:apiKey',function(req,res){ //res.setHeader('Content-Type', 'application/json'); res.sendStatus(401); } - } - }) + + }) app.get('/apiemployeelist/:apiKey',function(req,res){ apiGetEmployeeList(req.params.apiKey,function(err,w){ diff --git a/routes/employee.js b/routes/employee.js index 17d4e0f..9196ae1 100644 --- a/routes/employee.js +++ b/routes/employee.js @@ -4104,20 +4104,14 @@ router.get('/newPassword/:id', utils.ensureAuthenticated,function (req, res) { // Get employee list android -router.get('/androidList/:uid', function (req, res) { +router.get('/androidList/:uid', async function (req, res) { //calling.aFunction(); - androidApi.apiEmployee(req.params.uid,function(err,resp){ + var resp=await androidApi.apiEmployee(req.params.uid)//,function(err,resp){ - if(err){ - console.log(err); - return; - }else{ //sendEmailApiKey(document,apikey.apiKey) //console.log(document.name); res.send(resp); - } - }); });