From 06ef64627fff5cc86ed60720fe4ff4fb94744809 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 31 May 2022 16:41:58 +0200 Subject: [PATCH] Document authorizeUser --- utils/authorizeUser.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/utils/authorizeUser.ts b/utils/authorizeUser.ts index 45d58e5..0e29bef 100644 --- a/utils/authorizeUser.ts +++ b/utils/authorizeUser.ts @@ -4,6 +4,14 @@ import { client } from "./prismaClient" import { Interrupt } from "./interrupt" +/** + * Find the user who is authenticating in a request. + * + * _For API route usage._ + * + * @param req The request performed by the user. + * @returns The user. + */ export async function authorizeUser(req: NextApiRequest): Promise { const authorization = req.headers.authorization