Template
1
0
Files
boilerplate/api/routes/auth/session.ts
2025-09-19 18:58:02 +02:00

13 lines
404 B
TypeScript

import { UnauthorizedError } from "@platform/relay";
import { session } from "@platform/spec/auth/routes.ts";
import { getAccountById } from "~stores/read-store/methods.ts";
export default session.access("authenticated").handle(async ({ principal }) => {
const account = await getAccountById(principal.id);
if (account === undefined) {
return new UnauthorizedError();
}
return account;
});