Refactor feedback handling across components: Replace alert and confirm calls with centralized feedback functions for improved user experience. Update various components to utilize showError, showSuccess, and confirmAction for consistent messaging and confirmation dialogs. Enhance UI responsiveness and maintainability by streamlining feedback logic.

This commit is contained in:
Torsten Schulz (local)
2026-03-19 16:18:51 +01:00
parent 2c58ef37c4
commit 1774d7df88
35 changed files with 1097 additions and 1017 deletions

View File

@@ -141,6 +141,7 @@
<script>
import { mapGetters } from 'vuex';
import apiClient from '@/utils/axios.js';
import { showApiError, showError } from '@/utils/feedback.js';
export default {
name: 'VocabCourseListView',
@@ -273,7 +274,7 @@ export default {
},
async findCourseByCode() {
if (!this.shareCode.trim()) {
alert(this.$t('socialnetwork.vocab.courses.invalidCode'));
showError(this, this.$t('socialnetwork.vocab.courses.invalidCode'));
return;
}
this.loading = true;
@@ -286,7 +287,7 @@ export default {
this.openCourse(course.id);
} catch (e) {
console.error('Fehler beim Suchen des Kurses:', e);
alert(e.response?.data?.error || this.$t('socialnetwork.vocab.courses.courseNotFound'));
showApiError(this, e, this.$t('socialnetwork.vocab.courses.courseNotFound'));
} finally {
this.loading = false;
}
@@ -332,7 +333,7 @@ export default {
await this.loadAllCourses();
} catch (e) {
console.error('Fehler beim Erstellen des Kurses:', e);
alert(e.response?.data?.error || 'Fehler beim Erstellen des Kurses');
showApiError(this, e, 'Fehler beim Erstellen des Kurses');
}
},
async enroll(courseId) {
@@ -342,7 +343,7 @@ export default {
this.openCourse(courseId);
} catch (e) {
console.error('Fehler beim Einschreiben:', e);
alert(e.response?.data?.error || 'Fehler beim Einschreiben');
showApiError(this, e, 'Fehler beim Einschreiben');
}
},
openCourse(courseId) {