mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 18:44:14 +00:00
72541: InfoModule, EndUserAgreementComponent, UserAgreementGuard
This commit is contained in:
@@ -12,6 +12,7 @@ import { RequestService } from '../data/request.service';
|
||||
import { BrowseDefinition } from './browse-definition.model';
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { getUnauthorizedPath } from '../../app-routing.module';
|
||||
import { getEndUserAgreementPath } from '../../info/info-routing.module';
|
||||
|
||||
/**
|
||||
* This file contains custom RxJS operators that can be used in multiple places
|
||||
@@ -192,6 +193,17 @@ export const returnUnauthorizedUrlTreeOnFalse = (router: Router) =>
|
||||
return authorized ? authorized : router.parseUrl(getUnauthorizedPath())
|
||||
}));
|
||||
|
||||
/**
|
||||
* Operator that returns a UrlTree to the unauthorized page when the boolean received is false
|
||||
* @param router
|
||||
*/
|
||||
export const returnEndUserAgreementUrlTreeOnFalse = (router: Router) =>
|
||||
(source: Observable<boolean>): Observable<boolean | UrlTree> =>
|
||||
source.pipe(
|
||||
map((hasAgreed: boolean) => {
|
||||
return hasAgreed ? hasAgreed : router.parseUrl(getEndUserAgreementPath())
|
||||
}));
|
||||
|
||||
export const getFinishedRemoteData = () =>
|
||||
<T>(source: Observable<RemoteData<T>>): Observable<RemoteData<T>> =>
|
||||
source.pipe(find((rd: RemoteData<T>) => !rd.isLoading));
|
||||
|
Reference in New Issue
Block a user