mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Updated matcher in lookup-by-id routing module.
Converted id to const.
This commit is contained in:
@@ -2,7 +2,7 @@ import { LookupGuard } from './lookup-guard';
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, UrlSegment } from '@angular/router';
|
import { RouterModule, UrlSegment } from '@angular/router';
|
||||||
import { ObjectNotFoundComponent } from './objectnotfound/objectnotfound.component';
|
import { ObjectNotFoundComponent } from './objectnotfound/objectnotfound.component';
|
||||||
import { hasValue } from '../shared/empty.util';
|
import { hasValue, isNotEmpty } from '../shared/empty.util';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -11,14 +11,12 @@ import { hasValue } from '../shared/empty.util';
|
|||||||
matcher: (url) => {
|
matcher: (url) => {
|
||||||
// The expected path is :idType/:id
|
// The expected path is :idType/:id
|
||||||
const idType = url[0].path;
|
const idType = url[0].path;
|
||||||
let id;
|
|
||||||
// Allow for handles that are delimited with a forward slash.
|
// Allow for handles that are delimited with a forward slash.
|
||||||
if (url.length === 3) {
|
const id = url
|
||||||
id = url[1].path + '/' + url[2].path;
|
.slice(1)
|
||||||
} else {
|
.map((us: UrlSegment) => us.path)
|
||||||
id = url[1].path;
|
.join('/');
|
||||||
}
|
if (isNotEmpty(idType) && isNotEmpty(id)) {
|
||||||
if (hasValue(idType) && hasValue(id)) {
|
|
||||||
return {
|
return {
|
||||||
consumed: url,
|
consumed: url,
|
||||||
posParams: {
|
posParams: {
|
||||||
|
Reference in New Issue
Block a user