Enhance security and error handling in various components by refining error catch blocks to ignore specific errors, improving code clarity and consistency across the application.
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 4m10s

This commit is contained in:
Torsten Schulz (local)
2025-12-20 15:05:49 +01:00
parent c9037fec45
commit 6fda6ebad0
42 changed files with 117 additions and 113 deletions

View File

@@ -362,7 +362,7 @@ const approveUser = async (user) => {
setTimeout(() => successMessage.value = '', 3000)
await loadUsers()
} catch (error) {
} catch (_error) {
errorMessage.value = 'Fehler beim Freischalten des Benutzers'
setTimeout(() => errorMessage.value = '', 3000)
}
@@ -397,14 +397,14 @@ async function saveUserRoles() {
closeRoleModal()
await loadUsers()
} catch (error) {
} catch (_error) {
errorMessage.value = 'Fehler beim Aktualisieren der Rollen'
setTimeout(() => errorMessage.value = '', 3000)
}
}
const rejectUser = async (user) => {
window.showConfirmModal('Registrierung ablehnen', `Möchten Sie die Registrierung von ${user.name} wirklich ablehnen?`, async () => {
window.showConfirmModal('Registrierung ablehnen', `Möchten Sie die Registrierung von ${user.name} wirklich ablehnen?`, async () => {
try {
await $fetch('/api/cms/users/reject', {
method: 'POST',
@@ -422,7 +422,7 @@ const rejectUser = async (user) => {
const deactivateUser = async (user) => {
window.showConfirmModal('Benutzer deaktivieren', `Möchten Sie ${user.name} wirklich deaktivieren?`, async () => {
window.showConfirmModal('Benutzer deaktivieren', `Möchten Sie ${user.name} wirklich deaktivieren?`, async () => {
try {
await $fetch('/api/cms/users/deactivate', {
method: 'POST',

View File

@@ -566,8 +566,6 @@
import { ref, onMounted } from 'vue'
import { Settings, Calendar, Users as UsersIcon, CreditCard, Plus, Trash2, X, Loader2, AlertCircle, Check } from 'lucide-vue-next'
const authStore = useAuthStore()
const isLoading = ref(true)
const isSaving = ref(false)
const errorMessage = ref('')
@@ -596,7 +594,7 @@ const loadConfig = async () => {
try {
const response = await $fetch('/api/config')
config.value = response
} catch (error) {
} catch {
errorMessage.value = 'Fehler beim Laden der Konfiguration.'
} finally {
isLoading.value = false
@@ -615,7 +613,7 @@ const saveConfig = async () => {
})
successMessage.value = 'Konfiguration erfolgreich gespeichert!'
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Konfiguration erfolgreich gespeichert!') } catch (_e) {
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Konfiguration erfolgreich gespeichert!') } catch {
// Modal nicht verfügbar, ignorieren
}
setTimeout(() => {
@@ -623,7 +621,7 @@ const saveConfig = async () => {
}, 3000)
} catch (error) {
errorMessage.value = error.data?.message || 'Fehler beim Speichern der Konfiguration.'
try { window.showErrorModal && window.showErrorModal('Fehler', errorMessage.value) } catch (_e) {
try { window.showErrorModal && window.showErrorModal('Fehler', errorMessage.value) } catch {
// Modal nicht verfügbar, ignorieren
}
} finally {

View File

@@ -168,11 +168,11 @@ async function save() {
const updated = { ...current, seiten: { ...(current.seiten || {}), geschichte: html } }
try {
await $fetch('/api/config', { method: 'PUT', body: updated })
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Inhalt erfolgreich gespeichert!') } catch (_e) {
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Inhalt erfolgreich gespeichert!') } catch {
// Modal nicht verfügbar, ignorieren
}
} catch (error) {
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch (_e) {
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch {
// Modal nicht verfügbar, ignorieren
}
}

View File

@@ -621,11 +621,11 @@ const closeUploadModal = () => {
}
// Drag and Drop Events
const handleDragEnter = () => {
const _handleDragEnter = () => {
isDragOver.value = true
}
const handleDragLeave = () => {
const _handleDragLeave = () => {
isDragOver.value = false
}
@@ -675,7 +675,7 @@ const loadExistingData = async () => {
}
}
}
} catch (_error) {
} catch {
// Fehler beim Laden der Datei, ignorieren
}
}

View File

@@ -247,9 +247,7 @@
<script setup>
import { ref, onMounted } from 'vue'
import { Calendar, Plus, Trash2, Loader2, AlertCircle, Pencil } from 'lucide-vue-next'
const authStore = useAuthStore()
import { Plus, Trash2, Loader2, AlertCircle, Pencil } from 'lucide-vue-next'
const isLoading = ref(true)
const isSaving = ref(false)

View File

@@ -193,11 +193,11 @@ async function save() {
const updated = { ...current, seiten: { ...(current.seiten || {}), ttRegeln: html } }
try {
await $fetch('/api/config', { method: 'PUT', body: updated })
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Regeln erfolgreich gespeichert!') } catch (_e) {
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Regeln erfolgreich gespeichert!') } catch {
// Modal nicht verfügbar, ignorieren
}
} catch (error) {
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch (_e) {
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch {
// Modal nicht verfügbar, ignorieren
}
}
@@ -254,7 +254,7 @@ function insertRuleTemplate(type) {
<p class="text-gray-600 text-sm"><strong>Verstoß:</strong> [Was ist der Verstoß?]<br><strong>Strafe:</strong> [Welche Strafe wird verhängt?]<br><strong>Häufigkeit:</strong> [Bei wiederholten Verstößen?]</p>
</div>
`
bgColor = 'bg-green-50'
// bgColor = 'bg-green-50' // Nicht verwendet
break
case 'service':
template = `
@@ -263,7 +263,7 @@ function insertRuleTemplate(type) {
<p class="text-gray-600 text-sm"><strong>Regel:</strong> [Aufschlagregel hier eingeben]<br><strong>Technik:</strong> [Wie muss der Aufschlag ausgeführt werden?]<br><strong>Fehler:</strong> [Was gilt als Fehler?]</p>
</div>
`
bgColor = 'bg-yellow-50'
// bgColor = 'bg-yellow-50'
break
}

View File

@@ -120,11 +120,11 @@ async function save() {
const updated = { ...current, seiten: { ...(current.seiten || {}), ueberUns: html } }
try {
await $fetch('/api/config', { method: 'PUT', body: updated })
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Inhalt erfolgreich gespeichert!') } catch (_e) {
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Inhalt erfolgreich gespeichert!') } catch {
// Modal nicht verfügbar, ignorieren
}
} catch (error) {
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch (_e) {
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch {
// Modal nicht verfügbar, ignorieren
}
}

View File

@@ -135,7 +135,7 @@
<script setup>
import { ref, onMounted } from 'vue'
import { Calendar, Users, BarChart } from 'lucide-vue-next'
import { Users } from 'lucide-vue-next'
const route = useRoute()
const mannschaft = ref(null)

View File

@@ -283,7 +283,7 @@
</template>
<script setup>
import { ref, onMounted, computed } from 'vue'
import { ref, onMounted } from 'vue'
useHead({
title: 'Spielpläne - Mannschaften - Harheimer TC'
@@ -398,8 +398,6 @@ const filterData = () => {
}
// Zuerst nach aktueller Saison filtern (immer aktiv)
const currentDate = new Date()
const currentYear = currentDate.getFullYear()
// Da die Spiele bis 2026 gehen, nehmen wir die Saison 2025/26
// Saison läuft vom 01.07. bis 30.06. des Folgejahres
@@ -434,7 +432,7 @@ const filterData = () => {
const inSaison = spielDatum >= saisonStart && spielDatum <= saisonEnd
return inSaison
} catch (error) {
} catch (_error) {
console.error('Fehler beim Parsen von Termin:', termin, error)
return false
}
@@ -738,7 +736,7 @@ const getRowClass = (row) => {
// Standard: Weiß
return 'bg-white'
} catch (error) {
} catch {
return 'bg-white'
}
}

View File

@@ -771,7 +771,7 @@
<script setup>
import { ref, computed, onMounted } from 'vue'
import { Users, UserPlus, Mail, Phone, MapPin, FileText, Clock, Edit, Trash2, Loader2, AlertCircle, Table2, Grid3x3 } from 'lucide-vue-next'
import { UserPlus, Mail, Phone, MapPin, FileText, Clock, Edit, Trash2, Loader2, AlertCircle, Table2, Grid3x3 } from 'lucide-vue-next'
const authStore = useAuthStore()
@@ -1003,7 +1003,7 @@ const processBulkCSV = async (file) => {
}
// Parse data rows
bulkPreviewData.value = lines.slice(1).map((line, index) => {
bulkPreviewData.value = lines.slice(1).map((line, _index) => {
const values = parseCSVLine(line)
return {
firstName: values[firstNameIdx] || '',

View File

@@ -221,7 +221,7 @@ const loadProfile = async () => {
email: response.user.email,
phone: response.user.phone || ''
}
} catch (error) {
} catch {
errorMessage.value = 'Fehler beim Laden des Profils.'
} finally {
isLoading.value = false

View File

@@ -175,7 +175,7 @@ async function checkSubscription() {
}
})
alreadySubscribed.value = response.subscribed || false
} catch (err) {
} catch (_err) {
// Fehler ignorieren - könnte bedeuten, dass nicht abonniert ist
alreadySubscribed.value = false
} finally {

View File

@@ -206,7 +206,7 @@
</template>
<script setup>
import { ref, onMounted, computed } from 'vue'
import { ref, onMounted } from 'vue'
useHead({
title: 'Spielplan - Harheimer TC'

View File

@@ -243,7 +243,7 @@
</template>
<script setup>
import { Globe, FileText, Download, ExternalLink, Target, Circle, Zap, Play, Trophy, Users, BookOpen } from 'lucide-vue-next'
import { Globe, FileText, Target, Circle, Zap, Play, Trophy, Users, BookOpen } from 'lucide-vue-next'
useHead({
title: 'TT-Regeln - Harheimer TC',

View File

@@ -29,7 +29,7 @@ async function loadConfig() {
try {
const data = await $fetch('/api/config')
rawContent.value = data?.seiten?.geschichte || ''
} catch (_e) {
} catch {
rawContent.value = ''
}
}

View File

@@ -29,7 +29,7 @@ async function loadConfig() {
try {
const data = await $fetch('/api/config')
rawContent.value = data?.seiten?.ttRegeln || ''
} catch (_e) {
} catch {
rawContent.value = ''
}
}

View File

@@ -29,7 +29,7 @@ async function loadConfig() {
try {
const data = await $fetch('/api/config')
rawContent.value = data?.seiten?.ueberUns || ''
} catch (_e) {
} catch {
rawContent.value = ''
}
}