diff --git a/frontend/components/page/PageBreadcrumbs.vue b/frontend/components/page/PageBreadcrumbs.vue index e52ee22aa..9dc2c0c4b 100644 --- a/frontend/components/page/PageBreadcrumbs.vue +++ b/frontend/components/page/PageBreadcrumbs.vue @@ -98,25 +98,33 @@ let group: Group; let event: Event; const organizationRegex = /^(http:\/\/localhost:\d+|https?:\/\/[\w.-]+)(\/[a-z]{2})?\/organizations\/[0-9a-fA-F-]+(\/about)?$/; +const groupRegex = + /^(http:\/\/localhost:\d+|https?:\/\/[\w.-]+)(\/[a-z]{2})?\/organizations\/[0-9a-fA-F-]+\/groups\/([0-9a-fA-F-]+)(\/about)?$/; +const eventRegex = + /^(http:\/\/localhost:\d+|https?:\/\/[\w.-]+)(\/[a-z]{2})?\/events\/([0-9a-fA-F-]+)(\/about)?$/; if (organizationRegex.test(url)) { pageType = "organization"; await organizationStore.fetchById(id); organization = organizationStore.organization; -} else if (url.includes("/organizations/") && url.includes("/groups/")) { +} else if (groupRegex.test(url)) { pageType = "group"; - await groupStore.fetchById(idGroup); - group = groupStore.group; -} else if ( - url.includes("/events/") && - !url.includes("/organizations/") && - !url.includes("/groups/") && - !url.includes("/events/create") && - !url.includes("/events/search") -) { + const match = url.match(groupRegex); + const groupId = match ? match[4] : null; + + if (groupId) { + await groupStore.fetchById(groupId); + group = groupStore.group; + } +} else if (eventRegex.test(url)) { pageType = "event"; - await eventStore.fetchById(id); - event = eventStore.event; + const match = url.match(eventRegex); + const eventId = match ? match[3] : null; + + if (eventId) { + await eventStore.fetchById(eventId); + event = eventStore.event; + } } const breadcrumbs = ref([]);