This commit is contained in:
2026-06-24 14:20:05 +02:00
commit 1c859d20c8
442 changed files with 25625 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
export * from './isAuth'
+10
View File
@@ -0,0 +1,10 @@
import { MiddlewareFn } from 'type-graphql'
import { Context } from '@/src/types'
// https://typegraphql.com/docs/middlewares.html
export const isAuth: MiddlewareFn<Context> = async ({ context: { req }}, next) => {
if (!req.session?.userID) {
throw new Error('Unauthenticated!')
}
return await next()
}