feat(router): enhance club loading logic and update route parameter naming

- Refactored the loadClub method to handle club creation and permission checks, improving navigation based on user roles.
- Updated the route parameter from ':1' to ':clubId' in the router configuration for better clarity and consistency.
This commit is contained in:
Torsten Schulz (local)
2026-02-04 13:15:09 +01:00
parent 12184c2f72
commit 2c8cad52a7
2 changed files with 12 additions and 3 deletions

View File

@@ -305,8 +305,17 @@ export default {
}
},
loadClub() {
this.setCurrentClub(this.selectedClub);
async loadClub() {
await this.setCurrentClub(this.selectedClub);
if (this.selectedClub === 'new') {
this.$router.push('/createclub');
return;
}
// Wenn keine Berechtigung, auf Club-Ansicht mit Anfrage-Button
if (!this.hasPermission('statistics', 'read')) {
this.$router.push(`/showclub/${this.selectedClub}`);
return;
}
this.$router.push('/training-stats');
},

View File

@@ -28,7 +28,7 @@ const routes = [
{ path: '/activate/:activationCode', component: Activate },
{ path: '/', component: Home },
{ path: '/createclub', component: CreateClub },
{ path: '/showclub/:1', component: ClubView },
{ path: '/showclub/:clubId', component: ClubView },
{ path: '/members', component: MembersView },
{ path: '/diary', component: DiaryView },
{ path: '/pending-approvals', component: PendingApprovalsView},