Initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { getAgentSettings, updateAgentSettings } from '@/lib/firestore';
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
// TODO: Get userId from auth token
|
||||
const userId = 'test-user-id'; // Replace with actual auth
|
||||
const settings = await getAgentSettings(userId);
|
||||
return NextResponse.json({ settings });
|
||||
} catch (error) {
|
||||
console.error('Error fetching agent settings:', error);
|
||||
return NextResponse.json({ error: 'Failed to fetch settings' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function PUT(request: NextRequest) {
|
||||
try {
|
||||
const body = await request.json();
|
||||
// TODO: Get userId from auth token
|
||||
const userId = 'test-user-id'; // Replace with actual auth
|
||||
|
||||
await updateAgentSettings(userId, body);
|
||||
const settings = await getAgentSettings(userId);
|
||||
return NextResponse.json({ settings });
|
||||
} catch (error) {
|
||||
console.error('Error updating agent settings:', error);
|
||||
return NextResponse.json({ error: 'Failed to update settings' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user