15 lines
481 B
TypeScript
15 lines
481 B
TypeScript
import { defineEventHandler, readBody, createError, useRuntimeConfig } from 'h3';
|
|
import { adminLoginLogic } from './admin/_logic';
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const { adminPassword } = useRuntimeConfig();
|
|
try {
|
|
const body = await readBody(event);
|
|
return await adminLoginLogic(body, adminPassword);
|
|
} catch (error: any) {
|
|
throw createError({
|
|
statusCode: error.statusCode || 500,
|
|
statusMessage: error.message,
|
|
});
|
|
}
|
|
});
|