feat(products): implement category selection and product creation in receipt import

This commit is contained in:
Nils-Johan Gynther
2026-04-19 13:39:26 +02:00
parent 39b91d8c87
commit 632d084dbe
4 changed files with 151 additions and 15 deletions
+5 -3
View File
@@ -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,