mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-05 12:11:51 +02:00
🐛 Fix middleware logic when auth is required
This commit is contained in:
parent
d973cbccb5
commit
27bbe6f947
1 changed files with 1 additions and 1 deletions
|
@ -17,7 +17,7 @@ export const publicProcedure = t.procedure;
|
|||
export const middleware = t.middleware;
|
||||
|
||||
const checkAuthIfRequired = middleware(async ({ ctx, next }) => {
|
||||
if (process.env.AUTH_REQUIRED === "true" && ctx.session) {
|
||||
if (process.env.AUTH_REQUIRED === "true" && ctx.session.user.isGuest) {
|
||||
throw new TRPCError({ code: "UNAUTHORIZED", message: "Login is required" });
|
||||
}
|
||||
return next();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue