fix(route): update parameter type for PATCH function and correct image directory handling
This commit is contained in:
@@ -6,16 +6,16 @@ const API_BASE =
|
||||
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } },
|
||||
{ params }: { params: Promise<{ id: string }> },
|
||||
) {
|
||||
const { id } = await params;
|
||||
const session = await auth();
|
||||
if (!session || (session.user as any)?.role !== 'admin') {
|
||||
return NextResponse.json({ message: 'Förbjuden' }, { status: 403 });
|
||||
}
|
||||
|
||||
const body = await request.json();
|
||||
const res = await fetch(`${API_BASE}/api/users/${params.id}/role`, {
|
||||
method: 'PATCH',
|
||||
const res = await fetch(`${API_BASE}/api/users/${id}/role`, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${session.accessToken}`,
|
||||
|
||||
Reference in New Issue
Block a user