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 { Effect, Actions, ofType } from '@ngrx/effects';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { DiscoveryEntry } from 'alfresco-js-api';
|
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 { of } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
GET_REPOSITORY_STATUS,
|
GET_REPOSITORY_STATUS,
|
||||||
GetRepositoryStatusAction
|
GetRepositoryStatusAction
|
||||||
} from '../actions/repository.actions';
|
} from '../actions/repository.actions';
|
||||||
import { Router } from '@angular/router';
|
|
||||||
import { ContentApiService } from '../../services/content-api.service';
|
import { ContentApiService } from '../../services/content-api.service';
|
||||||
import { SetRepositoryStatusAction } from '../actions';
|
import { SetRepositoryStatusAction } from '../actions';
|
||||||
|
|
||||||
@@ -40,28 +39,21 @@ import { SetRepositoryStatusAction } from '../actions';
|
|||||||
export class RepositoryEffects {
|
export class RepositoryEffects {
|
||||||
constructor(
|
constructor(
|
||||||
private actions$: Actions,
|
private actions$: Actions,
|
||||||
private router: Router,
|
|
||||||
private contentApi: ContentApiService
|
private contentApi: ContentApiService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Effect()
|
@Effect()
|
||||||
getRepositoryStatus$ = this.actions$.pipe(
|
getRepositoryStatus$ = this.actions$.pipe(
|
||||||
ofType<GetRepositoryStatusAction>(GET_REPOSITORY_STATUS),
|
ofType<GetRepositoryStatusAction>(GET_REPOSITORY_STATUS),
|
||||||
switchMap(() => {
|
mergeMap(() => {
|
||||||
return this.contentApi.getRepositoryInformation().pipe(
|
return this.contentApi.getRepositoryInformation().pipe(
|
||||||
map(
|
map(
|
||||||
(response: DiscoveryEntry) =>
|
(response: DiscoveryEntry) =>
|
||||||
new SetRepositoryStatusAction(response.entry.repository.status)
|
new SetRepositoryStatusAction(response.entry.repository.status)
|
||||||
),
|
),
|
||||||
catchError(error => {
|
// needs proper error handling
|
||||||
this.redirectToLogin();
|
catchError(() => of({ type: 'noop' }))
|
||||||
return of(error);
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
private redirectToLogin() {
|
|
||||||
this.router.navigate(['login']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user