18 lines
556 B
TypeScript
18 lines
556 B
TypeScript
import axios from "axios";
|
|
export default defineEventHandler(async (event) => {
|
|
const body = await readBody(event)
|
|
console.log(body)
|
|
try {
|
|
console.log("MASUK DALAM SINI")
|
|
const response = await axios.post("http://10.10.150.129:8082/api/suratkontrol/datalog", body);
|
|
console.log(response.data)
|
|
return response.data
|
|
} catch (error) {
|
|
console.error("Error posting to surat kontrol API:", error);
|
|
|
|
throw createError({
|
|
statusCode: 500,
|
|
statusMessage: "Failed to fetch data from surat kontrol API",
|
|
});
|
|
}
|
|
}); |