V 2.0.2 Anzahl in der Liste als const
This commit is contained in:
@@ -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>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user