mirror of
https://github.com/aljazceru/enclava.git
synced 2025-12-17 23:44:24 +01:00
20 lines
715 B
TypeScript
20 lines
715 B
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
import { proxyRequest, handleProxyResponse } from '@/lib/proxy-auth'
|
|
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
// Get query parameters from the request
|
|
const { searchParams } = new URL(request.url)
|
|
const queryString = searchParams.toString()
|
|
const endpoint = `/api-internal/v1/audit${queryString ? `?${queryString}` : ''}`
|
|
|
|
const response = await proxyRequest(endpoint)
|
|
const data = await handleProxyResponse(response, 'Failed to fetch audit logs')
|
|
return NextResponse.json(data)
|
|
} catch (error) {
|
|
return NextResponse.json(
|
|
{ error: 'Failed to fetch audit logs' },
|
|
{ status: 500 }
|
|
)
|
|
}
|
|
} |