Skip to content

Commit

Permalink
Merge pull request #503 from geonetwork/feat-update-url-structure
Browse files Browse the repository at this point in the history
Update url structure to remove /home
  • Loading branch information
fgravin committed Jun 22, 2023
2 parents 4f619f6 + 2c0eb95 commit a7ecfc3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import {
RecordsService,
} from '@geonetwork-ui/feature/catalog'
import { ROUTER_ROUTE_SEARCH } from '@geonetwork-ui/feature/router'
import {
ROUTER_ROUTE_HOME,
ROUTER_ROUTE_ORGANISATIONS,
} from '../../../router/constants'
import { ROUTER_ROUTE_ORGANISATIONS } from '../../../router/constants'

@Component({
selector: 'datahub-key-figures',
Expand All @@ -19,8 +16,8 @@ import {
export class KeyFiguresComponent {
recordsCount$ = this.catalogRecords.recordsCount$.pipe(startWith('-'))
orgsCount$ = this.catalogOrgs.organisationsCount$.pipe(startWith('-'))
ROUTE_SEARCH = `/${ROUTER_ROUTE_HOME}/${ROUTER_ROUTE_SEARCH}`
ROUTE_ORGANISATIONS = `/${ROUTER_ROUTE_HOME}/${ROUTER_ROUTE_ORGANISATIONS}`
ROUTE_SEARCH = `/${ROUTER_ROUTE_SEARCH}`
ROUTE_ORGANISATIONS = `/${ROUTER_ROUTE_ORGANISATIONS}`

constructor(
private catalogRecords: RecordsService,
Expand Down
16 changes: 8 additions & 8 deletions apps/datahub/src/app/router/datahub-router.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ const RouterMock = {
}

const expectedRoutes = [
{
path: '',
redirectTo: 'home/news',
pathMatch: 'full',
},
{
path: 'home',
redirectTo: 'home/search',
pathMatch: 'full',
redirectTo: '',
pathMatch: 'prefix',
},
{
path: 'home',
path: '',
component: HomePageComponent,
data: {
shouldDetach: true,
},
children: [
{
path: '',
redirectTo: 'news',
pathMatch: 'prefix',
},
{
path: 'news',
component: NewsPageComponent,
Expand Down
16 changes: 8 additions & 8 deletions apps/datahub/src/app/router/datahub-router.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ export class DatahubRouterService {

buildRoutes(): Routes {
return [
{
path: '',
redirectTo: `${ROUTER_ROUTE_HOME}/${ROUTER_ROUTE_NEWS}`,
pathMatch: 'full',
},
{
path: ROUTER_ROUTE_HOME,
redirectTo: `${ROUTER_ROUTE_HOME}/${ROUTER_ROUTE_SEARCH}`,
pathMatch: 'full',
redirectTo: ``,
pathMatch: 'prefix',
},
{
path: ROUTER_ROUTE_HOME,
path: '',
component: HomePageComponent,
data: {
shouldDetach: true,
},
children: [
{
path: '',
redirectTo: ROUTER_ROUTE_NEWS,
pathMatch: 'prefix',
},
{
path: ROUTER_ROUTE_NEWS,
component: NewsPageComponent,
Expand Down

0 comments on commit a7ecfc3

Please sign in to comment.