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
}
}