26 lines
991 B
TypeScript
26 lines
991 B
TypeScript
import { getAuthHeaders } from '../../../lib/auth-headers';
|
|
import PendingProductsClient from '../../admin/products/pending/PendingProductsClient';
|
|
|
|
const API_BASE = process.env.NEXT_PUBLIC_API_URL_INTERNAL ?? 'http://recipe-api:8080';
|
|
|
|
export default async function ForslagTab() {
|
|
const headers = await getAuthHeaders();
|
|
let products: any[] = [];
|
|
try {
|
|
const res = await fetch(`${API_BASE}/api/products/pending`, { headers, cache: 'no-store' });
|
|
if (res.ok) products = await res.json();
|
|
} catch {
|
|
// backend ej nåbart
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
<h2 style={{ fontSize: '1.1rem', marginBottom: '0.5rem' }}>Väntande produktförslag</h2>
|
|
<p style={{ color: '#64748b', marginBottom: '1.5rem', fontSize: '0.9rem' }}>
|
|
Produkter som användare har föreslagit. Godkänn för att göra dem tillgängliga i katalogen, eller avvisa för att ta bort dem.
|
|
</p>
|
|
<PendingProductsClient products={products} />
|
|
</div>
|
|
);
|
|
}
|