forked from ttc/micro-service-api
-api เส้น register
-เครื่องมือต่างๆ (ไม่สมบูร)
This commit is contained in:
@@ -1,19 +1,13 @@
|
||||
// ===================================================
|
||||
// ⚙️ Nuttakit Response Layer vFinal++++++
|
||||
// ===================================================
|
||||
|
||||
export function sendError(thMsg = 'เกิดข้อผิดพลาดไม่คาดคิดเกิดขึ้น', enMsg = 'Unexpected error', code = 400) {
|
||||
export function sendError(thMsg = 'เกิดข้อผิดพลาดไม่คาดคิดเกิดขึ้น', enMsg = 'Unexpected error', code = 400, data = []) {
|
||||
return {
|
||||
code: String(code),
|
||||
message: enMsg,
|
||||
message_th: thMsg,
|
||||
data: []
|
||||
data: data
|
||||
}
|
||||
}
|
||||
|
||||
// ===================================================
|
||||
// 🔹 Auto Success Response (ใช้โดย Global Handler เท่านั้น)
|
||||
// ===================================================
|
||||
export function formatSuccessResponse(data) {
|
||||
return {
|
||||
code: "200",
|
||||
@@ -21,4 +15,4 @@ export function formatSuccessResponse(data) {
|
||||
message_th: "ดำเนินการสำเร็จ",
|
||||
data: data || null
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user