Skip to content

Commit

Permalink
fix(profile-breadcrumbs): For profile page, pull username breadcrumb …
Browse files Browse the repository at this point in the history
…from backend instead of url path
  • Loading branch information
crod951 committed Jan 23, 2025
1 parent 3055ac8 commit c451174
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/composables/stores/breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export default {
let keyToType = {
boardSlug: 'board',
slug: 'thread',
threadSlug: 'thread'
threadSlug: 'thread',
username: 'profile'
}
// remove anchor hash from params
let routeParamKeys = without(Object.keys(routeParams), '#')
Expand All @@ -60,11 +61,13 @@ export default {
// matches, route is dynamic
if (!isEmpty(matches)) {
let idKey = routeParamKeys.reverse()[0]
let id = routeParams[idKey]
// for proxy, use query parameter to get user id
let id = idKey !== 'username' ? routeParams[idKey] : $route.query.id
let type = keyToType[idKey]
let crumbs = await breadcrumbsApi.find(id, type)
breadcrumbs.splice(0, breadcrumbs.length)
breadcrumbs.push(pathLookup.home)
// for proxy, do not push 'Home' to breadcrumbs for profile page
if (idKey !== 'username') breadcrumbs.push(pathLookup.home)
breadcrumbs.push(...crumbs.breadcrumbs)

}
Expand Down

0 comments on commit c451174

Please sign in to comment.