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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,43 +1,36 @@ | |||
import { | import { | ||
HttpEvent, | HttpEvent, | ||
HttpInterceptor, | HttpInterceptor, | ||
HttpHandler, | HttpHandler, | ||
HttpRequest, | HttpRequest, | ||
HttpResponse, | HttpResponse, | ||
HttpErrorResponse | HttpErrorResponse | ||
} from '@angular/common/http'; | } from '@angular/common/http'; | ||
import { Observable, throwError } from 'rxjs'; | import {Observable, throwError} from 'rxjs'; | ||
import { retry, catchError } from 'rxjs/operators'; | import {retry, catchError} from 'rxjs/operators'; | ||
import { Component, Input} from '@angular/core'; | import {Component, Input} from '@angular/core'; | ||
|
|||
|
|
||
|
|
||
export class HttpErrorInterceptor implements HttpInterceptor { | export class HttpErrorInterceptor implements HttpInterceptor { | ||
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | ||
return next.handle(request) | return next.handle(request) | ||
.pipe( | .pipe( | ||
retry(1), | retry(1), | ||
catchError((error: HttpErrorResponse) => { | catchError((error: HttpErrorResponse) => { | ||
let errorMessage = ''; | let errorMessage = ''; | ||
if (error.error instanceof ErrorEvent) { | if (error.error instanceof ErrorEvent) { | ||
// client-side error | // client-side error | ||
errorMessage = `Error: ${error.error.message}`; | errorMessage = `Error: ${error.error.message}`; | ||
} | } else if (error.message === 'Http failure response for http://sd5-backend.engr.uconn.edu/auth: 404 Not Found') { | ||
else if (error.message == "Http failure response for http://sd5-backend.engr.uconn.edu/auth: 404 Not Found") | window.alert('Invalid Credentials'); | ||
{ |
|
||
//console.log(error.message); | } else { | ||
|
// server-side error | ||
window.alert("Invalid Credentials"); | errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`; | ||
} | |||
|
|
||
} | return throwError(errorMessage); | ||
else { | }) | ||
// server-side error | ); | ||
//console.log("poop"); | } | ||
errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`; | } | ||
} | |||
|
|||
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