mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
71429: Unauthorized component
This commit is contained in:
@@ -180,6 +180,19 @@ export const redirectToPageNotFoundOn404 = (router: Router) =>
|
||||
}
|
||||
}));
|
||||
|
||||
/**
|
||||
* Operator that redirects the user to the unauthorized page when the boolean received is false
|
||||
* @param router
|
||||
*/
|
||||
export const redirectToUnauthorizedOnFalse = (router: Router) =>
|
||||
(source: Observable<boolean>): Observable<boolean> =>
|
||||
source.pipe(
|
||||
tap((authorized: boolean) => {
|
||||
if (!authorized) {
|
||||
router.navigateByUrl('/401', { skipLocationChange: true });
|
||||
}
|
||||
}));
|
||||
|
||||
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