feat: redesign superadmin agencies list, implement flat design, add date filters, and fix UI bugs
This commit is contained in:
50
front-end-agency/app/api/agency/logo/route.ts
Normal file
50
front-end-agency/app/api/agency/logo/route.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const BACKEND_URL = process.env.API_INTERNAL_URL || 'http://aggios-backend:8080';
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const authorization = request.headers.get('authorization');
|
||||
|
||||
if (!authorization) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Unauthorized' },
|
||||
{ status: 401 }
|
||||
);
|
||||
}
|
||||
|
||||
// Get form data from request
|
||||
const formData = await request.formData();
|
||||
|
||||
console.log('Forwarding logo upload to backend:', BACKEND_URL);
|
||||
|
||||
// Forward to backend
|
||||
const response = await fetch(`${BACKEND_URL}/api/agency/logo`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': authorization,
|
||||
},
|
||||
body: formData,
|
||||
});
|
||||
|
||||
console.log('Backend response status:', response.status);
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
console.error('Backend error:', errorText);
|
||||
return NextResponse.json(
|
||||
{ error: errorText || 'Failed to upload logo' },
|
||||
{ status: response.status }
|
||||
);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
console.error('Logo upload error:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Internal server error: ' + (error instanceof Error ? error.message : String(error)) },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user