mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
fixed a bit of css
This commit is contained in:
1 parent
88d86835c6
commit
c62d191509
4 files changed
+56
-32
No files matched your search
@@ -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();
|
||||
|
||||
|
||||
Reference in new issue
Block a user