diff --git a/app/api/user/[user]/route.ts b/app/api/user/[user]/route.ts index 4ac20f50..0e09058c 100644 --- a/app/api/user/[user]/route.ts +++ b/app/api/user/[user]/route.ts @@ -11,7 +11,7 @@ export async function PATCH(req: NextRequest, { params }: { params: Promise<{ us } const { user: username } = await params - const role = ROLE.get(req.nextUrl.searchParams.get("role") || "") + const role = ROLE.get(req.nextUrl.searchParams.get("userRole") || "") try { if (!role) throw new Error("Role is missing") diff --git a/app/settings/users/Users.tsx b/app/settings/users/Users.tsx index 0d651c28..78e7fe11 100644 --- a/app/settings/users/Users.tsx +++ b/app/settings/users/Users.tsx @@ -27,7 +27,7 @@ export default function Users() { const { data: session } = useSession() const handleSetRole = async (username: string, role: string, oldRole?: string) => { - const result = await securedFetch(`api/user/${prepareArg(username)}`, { + const result = await securedFetch(`api/user/${prepareArg(username)}?userRole=${role}`, { method: 'PATCH' }, session?.user?.role, toast)