Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fixing some minor UI problems, linting for production, added refresh …
…timer on statistics page to fire every minute.
- Loading branch information
Evan Langlais
committed
Apr 17, 2019
1 parent
494bed8
commit b3e10c8
Showing
4 changed files
with
61 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,36 @@ | ||
import { | ||
HttpEvent, | ||
HttpInterceptor, | ||
HttpHandler, | ||
HttpRequest, | ||
HttpResponse, | ||
HttpErrorResponse | ||
HttpEvent, | ||
HttpInterceptor, | ||
HttpHandler, | ||
HttpRequest, | ||
HttpResponse, | ||
HttpErrorResponse | ||
} from '@angular/common/http'; | ||
import { Observable, throwError } from 'rxjs'; | ||
import { retry, catchError } from 'rxjs/operators'; | ||
import { Component, Input} from '@angular/core'; | ||
|
||
import {Observable, throwError} from 'rxjs'; | ||
import {retry, catchError} from 'rxjs/operators'; | ||
import {Component, Input} from '@angular/core'; | ||
|
||
|
||
export class HttpErrorInterceptor implements HttpInterceptor { | ||
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | ||
return next.handle(request) | ||
.pipe( | ||
retry(1), | ||
catchError((error: HttpErrorResponse) => { | ||
let errorMessage = ''; | ||
if (error.error instanceof ErrorEvent) { | ||
// client-side error | ||
errorMessage = `Error: ${error.error.message}`; | ||
} | ||
else if (error.message == "Http failure response for http://sd5-backend.engr.uconn.edu/auth: 404 Not Found") | ||
{ | ||
//console.log(error.message); | ||
|
||
window.alert("Invalid Credentials"); | ||
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | ||
return next.handle(request) | ||
.pipe( | ||
retry(1), | ||
catchError((error: HttpErrorResponse) => { | ||
let errorMessage = ''; | ||
if (error.error instanceof ErrorEvent) { | ||
// client-side error | ||
errorMessage = `Error: ${error.error.message}`; | ||
} else if (error.message === 'Http failure response for http://sd5-backend.engr.uconn.edu/auth: 404 Not Found') { | ||
window.alert('Invalid Credentials'); | ||
|
||
} else { | ||
// server-side error | ||
errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`; | ||
} | ||
|
||
} | ||
else { | ||
// server-side error | ||
//console.log("poop"); | ||
errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`; | ||
} | ||
|
||
return throwError(errorMessage); | ||
}) | ||
) | ||
} | ||
} | ||
return throwError(errorMessage); | ||
}) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters