V 2.0.2 Anzahl in der Liste als const

This commit is contained in:
rxf
2026-03-06 13:37:01 +01:00
parent 0861368e4e
commit 3cc9edd4de
2 changed files with 5 additions and 3 deletions

View File

@@ -6,6 +6,8 @@ import WerteList from '@/components/WerteList';
import { WerteEntry } from '@/types/werte'; import { WerteEntry } from '@/types/werte';
import TabLayout from '@/components/TabLayout'; import TabLayout from '@/components/TabLayout';
const MAX_ENTRIES = 15
export default function Home() { export default function Home() {
const [entries, setEntries] = useState<WerteEntry[]>([]); const [entries, setEntries] = useState<WerteEntry[]>([]);
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
@@ -17,7 +19,7 @@ export default function Home() {
// Fetch initial data // Fetch initial data
(async () => { (async () => {
try { try {
const response = await fetch('/api/werte?limit=14', { const response = await fetch(`/api/werte?limit=${MAX_ENTRIES}`, {
cache: 'no-store', cache: 'no-store',
headers: { headers: {
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
@@ -83,7 +85,7 @@ export default function Home() {
</div> </div>
<div className="bg-white border border-black rounded-lg shadow-md p-6"> <div className="bg-white border border-black rounded-lg shadow-md p-6">
<h2 className="text-xl font-semibold mb-4">Letzte 14 Einträge</h2> <h2 className="text-xl font-semibold mb-4">Letzte {MAX_ENTRIES} Einträge</h2>
{isLoading ? ( {isLoading ? (
<div className="text-center py-4">Lade Daten...</div> <div className="text-center py-4">Lade Daten...</div>
) : ( ) : (

View File

@@ -1,6 +1,6 @@
{ {
"name": "werte_next", "name": "werte_next",
"version": "2.0.1", "version": "2.0.2",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",