🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import { TRPCError } from '@trpc/server';
import { trpc } from '../lambda/init';
export const userAuth = trpc.middleware(async (opts) => {
const { ctx } = opts;
// `ctx.user` is nullable
if (!ctx.userId) {
throw new TRPCError({ code: 'UNAUTHORIZED' });
}
return opts.next({
// ✅ user value is known to be non-null now
ctx: { userId: ctx.userId },
});
});