Skip to content

Commit

Permalink
UI: fix for undefined title for some subpages
Browse files Browse the repository at this point in the history
  • Loading branch information
lwitkowski committed Aug 2, 2024
1 parent 6f177a9 commit c2c92b1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions ui/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const router = createRouter({
routes: [
{
path: '/',
name: 'all_listing',
name: 'all_offers',
component: OffersList,
meta: {
title: 'Aircraft Offers Overview',
Expand All @@ -19,10 +19,10 @@ const router = createRouter({
},
{
path: '/:aircraftType',
name: 'category_listing',
children: [
{
path: '/:aircraftType',
name: 'offers_for_type',
component: OffersList,
props: true
},
Expand All @@ -39,10 +39,17 @@ const router = createRouter({

router.afterEach((to) => {
nextTick(() => {
if (to.name === 'offer_details') {
document.title = `${to.params.aircraftType} ${to.params.manufacturer} ${to.params.model}`
} else {
document.title = to.meta.title
switch (to.name) {
case 'offers_for_type':
document.title = `${to.params.aircraftType.charAt(0).toUpperCase()}${to.params.aircraftType.slice(1)} offers`
break

case 'offer_details':
document.title = `${to.params.manufacturer} ${to.params.model} (${to.params.aircraftType}) offers`
break

default:
document.title = to.meta.title
}
})
})
Expand Down

0 comments on commit c2c92b1

Please sign in to comment.