feat(products): implement category selection and product creation in receipt import
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL_INTERNAL || 'http://recipe-api:8080';
|
||||
|
||||
export async function GET() {
|
||||
const res = await fetch(`${API_BASE}/api/categories/tree`, { cache: 'no-store' });
|
||||
export async function GET(req: NextRequest) {
|
||||
const isTree = req.nextUrl.searchParams.has('tree');
|
||||
const endpoint = isTree ? '/api/categories/tree' : '/api/categories';
|
||||
const res = await fetch(`${API_BASE}${endpoint}`, { cache: 'no-store' });
|
||||
const text = await res.text();
|
||||
return new NextResponse(text, {
|
||||
status: res.status,
|
||||
|
||||
Reference in New Issue
Block a user