Refactor CSV data loading in 'vereinsmeisterschaften.vue' and 'cms/vereinsmeisterschaften.vue' to utilize API endpoints instead of static files, addressing cache issues. Update debugging logs to reflect new data source and improve response header logging for better traceability.

This commit is contained in:
Torsten Schulz (local)
2025-11-14 22:37:37 +01:00
parent 1c8ccbb92c
commit 125ca6d7ce
3 changed files with 47 additions and 6 deletions

View File

@@ -335,9 +335,9 @@ const formData = ref({
const loadResults = async () => {
try {
// Cache-Busting: Füge Timestamp hinzu, um sicherzustellen, dass wir die neueste Version laden
// Verwende API-Endpoint statt statische Datei, um Cache-Probleme zu vermeiden
const timestamp = new Date().getTime()
const response = await fetch(`/data/vereinsmeisterschaften.csv?t=${timestamp}`, {
const response = await fetch(`/api/vereinsmeisterschaften?t=${timestamp}`, {
cache: 'no-cache',
headers: {
'Cache-Control': 'no-cache'
@@ -345,10 +345,10 @@ const loadResults = async () => {
})
console.log('=== FRONTEND LOAD DEBUG ===')
console.log('Load URL:', `/data/vereinsmeisterschaften.csv?t=${timestamp}`)
console.log('Load URL:', `/api/vereinsmeisterschaften?t=${timestamp}`)
console.log('Response Status:', response.status)
console.log('Response Headers - Last-Modified:', response.headers.get('last-modified'))
console.log('Response Headers - ETag:', response.headers.get('etag'))
console.log('Response Headers - Content-Type:', response.headers.get('content-type'))
console.log('Response Headers - Cache-Control:', response.headers.get('cache-control'))
if (!response.ok) {
console.error('Fehler beim Laden - Response nicht OK:', response.status)

View File

@@ -159,7 +159,8 @@ const selectedYear = ref('alle')
const loadResults = async () => {
try {
const response = await fetch('/data/vereinsmeisterschaften.csv')
// Verwende API-Endpoint statt statische Datei, um Cache-Probleme zu vermeiden
const response = await fetch('/api/vereinsmeisterschaften')
if (!response.ok) return
const csv = await response.text()