fixed a bit of css

This commit is contained in:
bobbert committed 2025-03-11 18:46:09 +00:00
1 parent 88d86835c6
commit c62d191509
4 files changed
+56 -32

No files matched your search

+11 -6
View File
@@ -4,19 +4,24 @@ import { authOptions } from '../../auth/[...nextauth]/route';
import { nanoid } from 'nanoid';
export async function POST(request) {
const session = await getServerSession(authOptions);
if (!session) {
return Response.json({ success: false, error: 'Unauthorized' }, { status: 401 });
}
try {
const session = await getServerSession(authOptions);
if (!session) {
return Response.json({ success: false, error: 'Unauthorised-tc' }, { status: 401 });
}
const { name, userId } = await request.json();
if (!name || name.trim() === '') {
return Response.json({ success: false, error: 'Team name is required' });
}
// Verify the requesting user matches the userId
if (session.user.id !== userId) {
return Response.json({ success: false, error: 'User ID mismatch' }, { status: 403 });
}
// Generate a unique team code (6 characters)
const teamCode = nanoid(6).toUpperCase();