22 lines
543 B
TypeScript
22 lines
543 B
TypeScript
export default defineEventHandler(async (event) => {
|
|
const xTagHeader = getRequestHeader(event, "x-tag");
|
|
|
|
if (!xTagHeader || xTagHeader !== "094ut234") {
|
|
throw createError({ statusCode: 401, statusMessage: "unauthenticated" });
|
|
}
|
|
|
|
const config = getNocoDbConfiguration();
|
|
const berthsTableId = "mczgos9hr3oa9qc";
|
|
|
|
const berths = await $fetch(`${config.url}/api/v2/tables/${berthsTableId}/records`, {
|
|
headers: {
|
|
"xc-token": config.token,
|
|
},
|
|
params: {
|
|
limit: 1000,
|
|
},
|
|
});
|
|
|
|
return berths;
|
|
});
|