```ts export const protectedAction = createSafeActionClient({ async middleware() { const session = await getServerAuthSession(); console.log(session); if (!session?.user) { throw new Error("Unauthorized!"); } return { session }; }, }); ``` using NextAuth and next-safe-actions