From 2a6c78552ddb5d7f9551291ec786ec2525508adc Mon Sep 17 00:00:00 2001 From: Sangwook Park <41150708+sw0501@users.noreply.github.com> Date: Wed, 29 Nov 2023 00:55:57 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20navigation=20API=20=EC=98=88=EC=99=B8?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BackendJS/BackendTS/routes/navigation.js | 8 ++++++++ BackendTS/routes/navigation.ts | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/BackendJS/BackendTS/routes/navigation.js b/BackendJS/BackendTS/routes/navigation.js index 351eced..45f92ca 100644 --- a/BackendJS/BackendTS/routes/navigation.js +++ b/BackendJS/BackendTS/routes/navigation.js @@ -417,8 +417,16 @@ router.get('/:startX/:startY/:endX/:endY/:type', (req, res) => __awaiter(void 0, method: 'GET' }, function (error, response, body) { return __awaiter(this, void 0, void 0, function* () { + if (JSON.parse(body).hasOwnProperty("error")) { + console.error(JSON.parse(body).error); + return res.status(500).json({ + error: JSON.parse(body).error + }); + } //JSON parse const NavigationList = JSON.parse(body).result; + //console.log(error); + //console.log(response); //1. 도보 시간, 2. 환승 개수, 3. 총 이동 시간 NavigationList.path.sort((a, b) => { if (a.info.totalWalk === b.info.totalWalk) { diff --git a/BackendTS/routes/navigation.ts b/BackendTS/routes/navigation.ts index 6ba03bd..43ea2cd 100644 --- a/BackendTS/routes/navigation.ts +++ b/BackendTS/routes/navigation.ts @@ -416,10 +416,20 @@ router.get('/:startX/:startY/:endX/:endY/:type',async(req:Request,res:Response)= method: 'GET' }, async function (error:Error, response:any, body:string) { + if(JSON.parse(body).hasOwnProperty("error")){ + console.error(JSON.parse(body).error); + return res.status(500).json({ + error: JSON.parse(body).error + }) + } + //JSON parse const NavigationList:NavigationResult = JSON.parse(body).result; - + //console.log(error); + //console.log(response); + + //1. 도보 시간, 2. 환승 개수, 3. 총 이동 시간 NavigationList.path.sort((a:NavigationPath, b:NavigationPath)=>{ if(a.info.totalWalk === b.info.totalWalk){