Openstatus www.openstatus.dev

๐Ÿ› invitation (#816)

authored by

Thibault Le Ouay and committed by
GitHub
eb276eb9 d6c5c4c9

+8 -8
+1 -6
apps/web/src/middleware.ts
··· 33 33 return subdomain; 34 34 }; 35 35 36 - const publicAppPaths = [ 37 - "/app/sign-in", 38 - "/app/sign-up", 39 - "/app/login", 40 - "/app/invite", 41 - ]; 36 + const publicAppPaths = ["/app/sign-in", "/app/sign-up", "/app/login"]; 42 37 43 38 // remove auth middleware if needed 44 39 // export const middleware = () => NextResponse.next();
+7 -2
packages/api/src/router/invitation.ts
··· 71 71 .returning() 72 72 .get(); 73 73 74 + if (process.env.NODE_ENV === "development") { 75 + console.log( 76 + `>>>> Invitation token: http://localhost:3000/app/invite?token=${token} <<<< `, 77 + ); 78 + } 74 79 // TODO: 75 80 await trackNewInvitation(); 76 81 ··· 132 137 }, 133 138 }); 134 139 135 - if (!opts.ctx.user?.id) return "Missing user"; 140 + if (!opts.ctx.session?.user?.id) return "Missing user"; 136 141 137 142 const _user = await opts.ctx.db.query.user.findFirst({ 138 - where: eq(user.id, opts.ctx.user.id), 143 + where: eq(user.id, Number(opts.ctx.session.user.id)), 139 144 }); 140 145 141 146 if (!_user) return "Invalid user";