-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Natalia Venditto
committed
May 27, 2019
1 parent
f26ef56
commit 561e350
Showing
7 changed files
with
71 additions
and
7 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,13 +1,13 @@ | ||
<section class="content__base"> | ||
<div class="supporter__base"> | ||
<a class="supporter__link" href="supporter-area" title="Don't be lazy. Support us">Don't be lazy! Support this mission!</a> | ||
<a class="supporter__link" href="supporter-area" title="Don't be lazy. Support us"> If you're already a supporter, get special perks!</a> | ||
</div> | ||
<ul class="teasergallery__base columncontrol__grid--lt2"> | ||
<li #lazyKitten *ngFor="let kitten of kittens" attr.data-attr="{{urlPrefix}}{{kitten.name}}{{urlSuffix}}" class="teaser__base teaser__base--one"> | ||
<img class="teaser__image" src="" alt="pic of {{kitten.name}}" /> | ||
<h3 class="teaser__hl">{{kitten.name}}</h3> | ||
<p class="teaser__summary">Lorem ipsum dolor sit amet bla bla bla</p> | ||
<a class="teaser__link" href="#">Know {{kitten.name}}</a> | ||
<a class="teaser__link" href="#">Support {{kitten.name}} to space!</a> | ||
</li> | ||
</ul> | ||
</section> |
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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { | ||
HttpRequest, | ||
HttpHandler, | ||
HttpEvent, | ||
HttpInterceptor, | ||
HttpResponse, | ||
HttpErrorResponse | ||
} from '@angular/common/http'; | ||
import { AuthenticationService } from '../services/authentication/authentication.service'; | ||
import { Observable } from 'rxjs'; | ||
import { map, catchError } from 'rxjs/operators'; | ||
import { Injectable, Injector } from '@angular/core'; | ||
|
||
|
||
@Injectable() | ||
export class CommonResInterceptor implements HttpInterceptor { | ||
// Must initialize injector in constructor to be able to inject and instantiate AuthenticationService directly | ||
constructor( | ||
private auth: AuthenticationService) {} | ||
|
||
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | ||
const certError: string = 'Unknown Error'; | ||
return next.handle(req) | ||
.pipe(map((event: HttpEvent<any>) => { | ||
if (event instanceof HttpResponse) { | ||
if (event.url.indexOf('api') >= 0 && event.body.exceptions) { | ||
// If session_token cookie is invalid, log user out and delete userId cookie | ||
if (event.body.exceptions.indexOf('exceptions') >= 0) { | ||
this.auth.sendBacktoHome(); | ||
} | ||
} | ||
} | ||
return event; | ||
})) | ||
.pipe(catchError((err: any, caught) => { | ||
if (err instanceof HttpErrorResponse) { | ||
this.auth.deleteToken(); | ||
if (err.status === 0 || err.statusText === certError) { | ||
console.error('You must accept the certificates'); | ||
} | ||
return Observable.throw(err); | ||
} | ||
})); | ||
} | ||
} |
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