From 6ff672c5f191c852868e39d598d374df3e3866d0 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 4 Feb 2026 13:32:41 +0100 Subject: [PATCH] fix(club): improve error handling and access logic in loadClub method - Refactored the loadClub method to handle access checks more effectively, ensuring fallback club data is used when access is denied. - Enhanced error handling to manage access request status and provide appropriate user feedback based on backend responses. --- frontend/src/views/ClubView.vue | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/ClubView.vue b/frontend/src/views/ClubView.vue index e60ec508..0ccd5c76 100644 --- a/frontend/src/views/ClubView.vue +++ b/frontend/src/views/ClubView.vue @@ -128,17 +128,20 @@ export default { async loadClub() { try { const clubId = this.getClubId(); - // Wenn keine Berechtigung: Clubnamen aus der Liste verwenden, kein /clubs/:id Request - if (!this.canAccessClub()) { - const club = this.clubs.find(c => String(c.id) === String(clubId)); - this.club = club || { name: '' }; - this.accessAllowed = false; - return; - } + 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(); + 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'; + return; + } this.accessAllowed = false; const message = safeErrorMessage(error, this.$t('club.accessDenied')); await this.showInfo(this.$t('messages.error'), message, '', 'error');