11 lines
259 B
TypeScript
11 lines
259 B
TypeScript
|
export default eventHandler((event) => {
|
||
|
if (event.context.currentUser) {
|
||
|
return {
|
||
|
token: getHeader(event, "Authorization"),
|
||
|
user: event.context.currentUser,
|
||
|
};
|
||
|
} else {
|
||
|
throw createError({ statusCode: 400, message: "unauthenticated" });
|
||
|
}
|
||
|
});
|