Enabled page refreshing so that ledger and other reports can refresh by clicking show.
Fixed: Auth interceptor was swallowing the error.
This commit is contained in:
parent
bf14b46b15
commit
927c693a6f
@ -16,8 +16,10 @@ const appRoutes: Routes = [
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
RouterModule.forRoot(
|
RouterModule.forRoot(
|
||||||
appRoutes,
|
appRoutes,
|
||||||
// {enableTracing: true} // <-- debugging purposes only
|
{
|
||||||
{} // <-- debugging purposes only
|
onSameUrlNavigation: 'reload',
|
||||||
|
// enableTracing: true <-- debugging purposes only
|
||||||
|
}
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/internal/Observable';
|
import {Observable} from 'rxjs/internal/Observable';
|
||||||
|
import {throwError} from 'rxjs';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@ -25,12 +26,11 @@ export class ErrorLoggerService {
|
|||||||
|
|
||||||
// // Let the app keep running by returning an empty result.
|
// // Let the app keep running by returning an empty result.
|
||||||
// return of(result as T);
|
// return of(result as T);
|
||||||
return Observable.create(subscriber => subscriber.error(error));
|
return throwError(error);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public log(serviceName = 'error-logger', message: string) {
|
public log(serviceName = 'error-logger', message: string) {
|
||||||
console.log(serviceName + 'Service: ' + message);
|
console.log(serviceName + 'Service: ' + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';
|
import {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';
|
||||||
|
|
||||||
import {Observable, ObservableInput, of as observableOf} from 'rxjs';
|
import {Observable, throwError} from 'rxjs';
|
||||||
import {catchError} from 'rxjs/operators';
|
import {catchError} from 'rxjs/operators';
|
||||||
import {ToasterService} from './toaster.service';
|
import {ToasterService} from './toaster.service';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
@ -18,8 +18,8 @@ export class HttpAuthInterceptor implements HttpInterceptor {
|
|||||||
Observable<HttpEvent<any>> {
|
Observable<HttpEvent<any>> {
|
||||||
return next.handle(req)
|
return next.handle(req)
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: any, caught: Observable<any>): ObservableInput<{}> => {
|
catchError((error: any) => {
|
||||||
if (err.status === 401) {
|
if (error.status === 401) {
|
||||||
this.toaster.show('Danger', 'User has been logged out');
|
this.toaster.show('Danger', 'User has been logged out');
|
||||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||||
width: '250px',
|
width: '250px',
|
||||||
@ -34,7 +34,7 @@ export class HttpAuthInterceptor implements HttpInterceptor {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return observableOf(caught);
|
return throwError(error);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user