From c5e751a2ea441a7a31469a40d20ee14ed58bfa69 Mon Sep 17 00:00:00 2001 From: x2Skyz Date: Mon, 17 Nov 2025 15:05:19 +0700 Subject: [PATCH] =?UTF-8?q?-=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=20=E0=B8=99=E0=B8=B3=E0=B8=A3=E0=B8=B0=E0=B8=9A=E0=B8=9A=20=20?= =?UTF-8?q?=E0=B8=AA=E0=B9=88=E0=B8=87=20token=20=E0=B9=83=E0=B8=99=20body?= =?UTF-8?q?=20=E0=B8=AD=E0=B8=AD=E0=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exthernal-ttc-api/src/controllers/budgetAddController.js | 2 +- exthernal-ttc-api/src/interfaces/Interface.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exthernal-ttc-api/src/controllers/budgetAddController.js b/exthernal-ttc-api/src/controllers/budgetAddController.js index 793d8bf..a81f088 100644 --- a/exthernal-ttc-api/src/controllers/budgetAddController.js +++ b/exthernal-ttc-api/src/controllers/budgetAddController.js @@ -26,7 +26,7 @@ export class budgetAdd { let idx = -1 let aryResult = [] try { - let token = req.body.request.token; + let token = req.headers.authorization?.split(' ')[1]; const decoded = verifyToken(token); let name = req.body.request.bdgnam; diff --git a/exthernal-ttc-api/src/interfaces/Interface.js b/exthernal-ttc-api/src/interfaces/Interface.js index 0e09e7b..1978a85 100644 --- a/exthernal-ttc-api/src/interfaces/Interface.js +++ b/exthernal-ttc-api/src/interfaces/Interface.js @@ -18,7 +18,7 @@ export class Interface { } // =============================================================== - // 📌 saveInterface → แกะ token เอง และ route ไปยัง interface เฉพาะ table + // saveInterface → แกะ token เอง และ route ไปยัง interface เฉพาะ table // =============================================================== async saveInterface(tableName, data, req) { @@ -45,7 +45,7 @@ export class Interface { return new sendError('Invalid token: ' + err.message) } - const schema = decoded.organization // ⭐ ได้ schema ที่ต้องการ + const schema = decoded.organization if (!schema) return new sendError("Token missing 'organization' field") // ------------------------------