From 2d67b0b13ef2bccd74987ee4a98d88a1a6ec85e1 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Tue, 27 Oct 2020 12:29:39 +0100 Subject: [PATCH] 74053: remove fdescribe + use consts for routing paths --- src/app/app-routing-paths.ts | 6 ++++++ src/app/core/shared/operators.spec.ts | 2 +- src/app/core/shared/operators.ts | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/app-routing-paths.ts b/src/app/app-routing-paths.ts index f9fc448b99..2b57a1957c 100644 --- a/src/app/app-routing-paths.ts +++ b/src/app/app-routing-paths.ts @@ -61,6 +61,12 @@ export function getUnauthorizedRoute() { return `/${UNAUTHORIZED_PATH}`; } +export const PAGE_NOT_FOUND_PATH = '404'; + +export function getPageNotFoundRoute() { + return `/${PAGE_NOT_FOUND_PATH}`; +} + export const INFO_MODULE_PATH = 'info'; export function getInfoModulePath() { return `/${INFO_MODULE_PATH}`; diff --git a/src/app/core/shared/operators.spec.ts b/src/app/core/shared/operators.spec.ts index 401efae760..8acf5ea860 100644 --- a/src/app/core/shared/operators.spec.ts +++ b/src/app/core/shared/operators.spec.ts @@ -24,7 +24,7 @@ import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils'; -fdescribe('Core Module - RxJS Operators', () => { +describe('Core Module - RxJS Operators', () => { let scheduler: TestScheduler; let requestService: RequestService; const testRequestHref = 'https://rest.api/'; diff --git a/src/app/core/shared/operators.ts b/src/app/core/shared/operators.ts index 41e9c7e18a..ecc1f53933 100644 --- a/src/app/core/shared/operators.ts +++ b/src/app/core/shared/operators.ts @@ -13,7 +13,7 @@ import { MetadataField } from '../metadata/metadata-field.model'; import { MetadataSchema } from '../metadata/metadata-schema.model'; import { BrowseDefinition } from './browse-definition.model'; import { DSpaceObject } from './dspace-object.model'; -import { getUnauthorizedRoute } from '../../app-routing-paths'; +import { getPageNotFoundRoute, getUnauthorizedRoute } from '../../app-routing-paths'; import { getEndUserAgreementPath } from '../../info/info-routing-paths'; /** @@ -181,9 +181,9 @@ export const redirectOn404Or401 = (router: Router) => tap((rd: RemoteData) => { if (rd.hasFailed) { if (rd.error.statusCode === 404) { - router.navigateByUrl('/404', {skipLocationChange: true}); + router.navigateByUrl(`/${getPageNotFoundRoute()}`, {skipLocationChange: true}); } else if (rd.error.statusCode === 401) { - router.navigateByUrl('/401', {skipLocationChange: true}); + router.navigateByUrl(`/${getUnauthorizedRoute()}`, {skipLocationChange: true}); } } }));