feat(products): add public access to findAll and findAllTags endpoints
feat(ai): enhance AI admin client with status messages for API key configuration refactor(api): remove authorization check from products route
This commit is contained in:
@@ -1,18 +1,13 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { getAuthHeaders } from '../../../lib/auth-headers';
|
||||
|
||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL_INTERNAL || 'http://recipe-api:8080';
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const authHeaders = await getAuthHeaders();
|
||||
if (!authHeaders.Authorization) {
|
||||
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
||||
}
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const url = new URL(req.url);
|
||||
const query = url.searchParams.toString();
|
||||
const res = await fetch(`${API_BASE}/api/products${query ? `?${query}` : ''}`, {
|
||||
headers: authHeaders,
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user