equipes keycloak flow
This commit is contained in:
parent
d40811a1e8
commit
ca3bdb0f07
@ -5,7 +5,7 @@ import { getKeycloakAdminClient } from "@/lib/keycloak";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
context: { params: { userId: string } }
|
||||
{ params }: { params: { userId?: string } }
|
||||
) {
|
||||
try {
|
||||
const session = await getServerSession(authOptions);
|
||||
@ -13,8 +13,9 @@ export async function GET(
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
|
||||
// Use the userId from context instead of trying to destructure it
|
||||
const userId = context.params.userId.toString();
|
||||
// Just get the primitive value directly
|
||||
const rawUserId = params?.userId;
|
||||
const userId = typeof rawUserId === 'string' ? rawUserId : '';
|
||||
|
||||
if (!userId) {
|
||||
return NextResponse.json({ error: "User ID is required" }, { status: 400 });
|
||||
@ -75,7 +76,7 @@ export async function GET(
|
||||
|
||||
export async function PUT(
|
||||
request: Request,
|
||||
context: { params: { userId: string } }
|
||||
{ params }: { params: { userId?: string } }
|
||||
) {
|
||||
try {
|
||||
const session = await getServerSession(authOptions);
|
||||
@ -83,8 +84,9 @@ export async function PUT(
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
|
||||
// Use the userId from context instead of trying to destructure it
|
||||
const userId = context.params.userId.toString();
|
||||
// Just get the primitive value directly
|
||||
const rawUserId = params?.userId;
|
||||
const userId = typeof rawUserId === 'string' ? rawUserId : '';
|
||||
|
||||
if (!userId) {
|
||||
return NextResponse.json({ error: "User ID is required" }, { status: 400 });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user