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');