feat: translate API error messages to English
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ export async function GET(request: NextRequest) {
|
||||
const session = await getServerSession(authOptions);
|
||||
|
||||
if (!session?.user) {
|
||||
return NextResponse.json({ error: "No autorizado" }, { status: 401 });
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
|
||||
const users = await db.user.findMany({
|
||||
@@ -45,7 +45,7 @@ export async function GET(request: NextRequest) {
|
||||
} catch (error) {
|
||||
console.error("Error fetching users:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Error al obtener usuarios" },
|
||||
{ error: "Error fetching users" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
@@ -56,12 +56,12 @@ export async function POST(request: NextRequest) {
|
||||
const session = await getServerSession(authOptions);
|
||||
|
||||
if (!session?.user) {
|
||||
return NextResponse.json({ error: "No autorizado" }, { status: 401 });
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
|
||||
// Only super_admin and site_admin can create users
|
||||
if (!["super_admin", "site_admin"].includes(session.user.role)) {
|
||||
return NextResponse.json({ error: "Sin permisos" }, { status: 403 });
|
||||
return NextResponse.json({ error: "Insufficient permissions" }, { status: 403 });
|
||||
}
|
||||
|
||||
const body = await request.json();
|
||||
@@ -69,7 +69,7 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
if (!email || !password || !firstName || !lastName || !role) {
|
||||
return NextResponse.json(
|
||||
{ error: "Faltan campos requeridos" },
|
||||
{ error: "Missing required fields" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
if (existingUser) {
|
||||
return NextResponse.json(
|
||||
{ error: "El email ya está registrado" },
|
||||
{ error: "This email is already registered" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ export async function POST(request: NextRequest) {
|
||||
} catch (error) {
|
||||
console.error("Error creating user:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Error al crear usuario" },
|
||||
{ error: "Error creating user" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user