mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
noop catchError (#675)
This commit is contained in:
committed by
Denys Vuika
parent
93e6489881
commit
3ca68f751b
@@ -26,13 +26,12 @@
|
||||
import { Effect, Actions, ofType } from '@ngrx/effects';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { DiscoveryEntry } from 'alfresco-js-api';
|
||||
import { map, switchMap, catchError } from 'rxjs/operators';
|
||||
import { map, mergeMap, catchError } from 'rxjs/operators';
|
||||
import { of } from 'rxjs';
|
||||
import {
|
||||
GET_REPOSITORY_STATUS,
|
||||
GetRepositoryStatusAction
|
||||
} from '../actions/repository.actions';
|
||||
import { Router } from '@angular/router';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { SetRepositoryStatusAction } from '../actions';
|
||||
|
||||
@@ -40,28 +39,21 @@ import { SetRepositoryStatusAction } from '../actions';
|
||||
export class RepositoryEffects {
|
||||
constructor(
|
||||
private actions$: Actions,
|
||||
private router: Router,
|
||||
private contentApi: ContentApiService
|
||||
) {}
|
||||
|
||||
@Effect()
|
||||
getRepositoryStatus$ = this.actions$.pipe(
|
||||
ofType<GetRepositoryStatusAction>(GET_REPOSITORY_STATUS),
|
||||
switchMap(() => {
|
||||
mergeMap(() => {
|
||||
return this.contentApi.getRepositoryInformation().pipe(
|
||||
map(
|
||||
(response: DiscoveryEntry) =>
|
||||
new SetRepositoryStatusAction(response.entry.repository.status)
|
||||
),
|
||||
catchError(error => {
|
||||
this.redirectToLogin();
|
||||
return of(error);
|
||||
})
|
||||
// needs proper error handling
|
||||
catchError(() => of({ type: 'noop' }))
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
private redirectToLogin() {
|
||||
this.router.navigate(['login']);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user