-แก้ไข นำระบบ ส่ง token ใน body ออก

This commit is contained in:
2025-11-17 15:05:19 +07:00
parent 0185c54fb3
commit c5e751a2ea
2 changed files with 3 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ export class budgetAdd {
let idx = -1 let idx = -1
let aryResult = [] let aryResult = []
try { try {
let token = req.body.request.token; let token = req.headers.authorization?.split(' ')[1];
const decoded = verifyToken(token); const decoded = verifyToken(token);
let name = req.body.request.bdgnam; let name = req.body.request.bdgnam;

View File

@@ -18,7 +18,7 @@ export class Interface {
} }
// =============================================================== // ===============================================================
// 📌 saveInterface → แกะ token เอง และ route ไปยัง interface เฉพาะ table // saveInterface → แกะ token เอง และ route ไปยัง interface เฉพาะ table
// =============================================================== // ===============================================================
async saveInterface(tableName, data, req) { async saveInterface(tableName, data, req) {
@@ -45,7 +45,7 @@ export class Interface {
return new sendError('Invalid token: ' + err.message) 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") if (!schema) return new sendError("Token missing 'organization' field")
// ------------------------------ // ------------------------------