Skip to content

Commit

Permalink
feat: define root meta for root redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Apr 25, 2023
1 parent 1abcbc0 commit c6bc3aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 3 additions & 5 deletions packages/web-app-webfinger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ const appInfo = {

const routes = () => [
{
name: 'root',
name: 'webfinger-root',
path: '/',
redirect: () => {
return { name: 'webfinger-resolve' }
},
meta: {
root: true
}
},
{
Expand All @@ -30,7 +27,8 @@ const routes = () => [
component: Resolve,
meta: {
authContext: 'user',
title: $gettext('Resolve ownCloud')
title: $gettext('Resolve ownCloud'),
root: true
}
}
]
Expand Down
7 changes: 6 additions & 1 deletion packages/web-runtime/src/container/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,12 @@ export const announceDefaults = ({
defaultExtensionId = appIds[0]
}

const route = store.getters.getNavItemsByExtension(defaultExtensionId)[0]?.route
let route = store.getters.getNavItemsByExtension(defaultExtensionId)[0]?.route
if (!route) {
route = router.getRoutes().find((r) => {
return r.path.startsWith(`/${defaultExtensionId}`) && r.meta?.root === true
})
}
if (route) {
router.addRoute({
path: '/',
Expand Down

0 comments on commit c6bc3aa

Please sign in to comment.