feat: translate API error messages to English
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,14 +35,14 @@ export async function GET(
|
||||
});
|
||||
|
||||
if (!site) {
|
||||
return NextResponse.json({ error: 'Sede no encontrada' }, { status: 404 });
|
||||
return NextResponse.json({ error: 'Site not found' }, { status: 404 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ data: site });
|
||||
} catch (error) {
|
||||
console.error('Error fetching site:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Error al obtener sede' },
|
||||
{ error: 'Error fetching site' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export async function PUT(
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -76,7 +76,7 @@ export async function PUT(
|
||||
});
|
||||
|
||||
if (!existingSite) {
|
||||
return NextResponse.json({ error: 'Sede no encontrada' }, { status: 404 });
|
||||
return NextResponse.json({ error: 'Site not found' }, { status: 404 });
|
||||
}
|
||||
|
||||
const updateData: any = {};
|
||||
@@ -102,7 +102,7 @@ export async function PUT(
|
||||
} catch (error) {
|
||||
console.error('Error updating site:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Error al actualizar sede' },
|
||||
{ error: 'Error updating site' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
@@ -121,7 +121,7 @@ export async function DELETE(
|
||||
}
|
||||
|
||||
if (session.user.role !== 'super_admin') {
|
||||
return NextResponse.json({ error: 'Sin permisos' }, { status: 403 });
|
||||
return NextResponse.json({ error: 'Insufficient permissions' }, { status: 403 });
|
||||
}
|
||||
|
||||
// Verify site belongs to organization
|
||||
@@ -133,7 +133,7 @@ export async function DELETE(
|
||||
});
|
||||
|
||||
if (!existingSite) {
|
||||
return NextResponse.json({ error: 'Sede no encontrada' }, { status: 404 });
|
||||
return NextResponse.json({ error: 'Site not found' }, { status: 404 });
|
||||
}
|
||||
|
||||
// Soft delete
|
||||
@@ -146,7 +146,7 @@ export async function DELETE(
|
||||
} catch (error) {
|
||||
console.error('Error deleting site:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Error al eliminar sede' },
|
||||
{ error: 'Error deleting site' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -88,7 +88,7 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
if (!name || !address) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Nombre y dirección son requeridos' },
|
||||
{ error: 'Name and address are required' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ export async function POST(request: NextRequest) {
|
||||
} catch (error) {
|
||||
console.error('Error creating site:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Error al crear sede' },
|
||||
{ error: 'Error creating site' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user