1
0

74053: remove fdescribe + use consts for routing paths

This commit is contained in:
Kristof De Langhe
2020-10-27 12:29:39 +01:00
parent 736704aae8
commit 2d67b0b13e
3 changed files with 10 additions and 4 deletions

View File

@@ -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}`;

View File

@@ -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/';

View File

@@ -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<T>) => {
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});
}
}
}));