From f9a63a13ce0d6a3ef70b90f6fc5868d96e13d6f6 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 4 Feb 2026 13:42:33 +0100 Subject: [PATCH] fix(club): enhance error handling in loadClub method - Improved error handling in the loadClub method to check response status directly, ensuring proper fallback club data is used when access is denied. - Updated logic to throw an error for unexpected response statuses, enhancing user feedback and robustness in access management. --- frontend/src/views/ClubView.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/ClubView.vue b/frontend/src/views/ClubView.vue index 04c64f8d..f1e71ec3 100644 --- a/frontend/src/views/ClubView.vue +++ b/frontend/src/views/ClubView.vue @@ -130,18 +130,20 @@ export default { const clubId = this.getClubId(); this.accessRequested = false; const response = await apiClient.get(`/clubs/${clubId}`); - this.club = response.data || { name: '' }; - this.accessAllowed = true; - } catch (error) { - // Kein Zugriff: Status vom Backend nutzen (requested/notrequested) - if (error?.response?.status === 403 && error?.response?.data?.status) { - const clubId = this.getClubId(); + // apiClient behandelt 4xx als "erfolgreich" -> Status selbst prüfen + if (response.status === 403 && response.data?.status) { const club = this.clubs.find(c => String(c.id) === String(clubId)); this.club = club || { name: '' }; this.accessAllowed = false; - this.accessRequested = error.response.data.status === 'requested'; + this.accessRequested = response.data.status === 'requested'; return; } + if (response.status >= 400) { + throw new Error('club_access_error'); + } + this.club = response.data || { name: '' }; + this.accessAllowed = true; + } catch (error) { this.accessAllowed = false; const message = safeErrorMessage(error, this.$t('club.accessDenied')); await this.showInfo(this.$t('messages.error'), message, '', 'error');