อัปเดตจำนวนสิทธิ์การลาเมื่อผ่านทดลองงานฯ #2304
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m19s

This commit is contained in:
harid 2026-02-12 18:31:24 +07:00
parent d555c70af9
commit 9a1acc0b7d
2 changed files with 112 additions and 28 deletions

View file

@ -100,6 +100,52 @@ class CallAPI {
}
}
// Put
public async PutData(request: any, @Path() path: any, sendData: any, log = true) {
const token = "Bearer " + request.headers.authorization.replace("Bearer ", "");
const url = process.env.API_URL + path;
try {
const response = await axios.put(url, sendData, {
headers: {
Authorization: `${token}`,
"Content-Type": "application/json",
api_key: process.env.API_KEY,
},
});
if (log)
addLogSequence(request, {
action: "request",
status: "success",
description: "connected",
request: {
method: "PUT",
url: url,
payload: JSON.stringify(sendData),
response: JSON.stringify(response.data.result),
},
});
return response.data.result;
} catch (error) {
if (log)
addLogSequence(request, {
action: "request",
status: "error",
description: "unconnected",
request: {
method: "PUT",
url: url,
payload: JSON.stringify(sendData),
response: JSON.stringify(error),
},
});
throw error;
}
}
//Delete File
public async DeleteFile(request: any, @Path() path: any) {
const token = "Bearer " + request.headers.authorization.replace("Bearer ", "");