15 lines
408 B
TypeScript
15 lines
408 B
TypeScript
|
import { readAccounts } from "~/server/database";
|
||
|
import { AccountSession } from "~/shared/types/account";
|
||
|
|
||
|
export default defineEventHandler(async (event) => {
|
||
|
const session = await getAccountSession(event);
|
||
|
if (!session)
|
||
|
return;
|
||
|
const accounts = await readAccounts();
|
||
|
|
||
|
return {
|
||
|
id: session.id,
|
||
|
account: accounts.find(account => account.id === session.accountId)!,
|
||
|
} satisfies AccountSession;
|
||
|
})
|