Toggle navigation
P3X GitList Snapshot
GitHub
Repo
Changelog
To do
Releases
Themes
Change log
Loading change log ...
To do ...
Loading todo ...
browsing:
e791586e403da2bb8a59e9255e518332e5998ea7
Branches
master
Files
Commits
Log
Graph
Stats
angular-http-cache-interceptor.git
src
app
app.component.ts
RSS
Git
Fetch origin
Download
ZIP
TAR
Clone
Raw
View
History
Clone
SSH
HTTPS
Blames found: 13
Mode: application/typescript
Binary: false
Hang on, we reloading big blames...
13cfe858
import { Component } from '@angular/core';
03046eed
import { HttpClient } from "@angular/common/http"; import {MatSnackBar} from "@angular/material/snack-bar";
671c88f6
import { CachingHeaders} from "../../projects/angular-http-cache-interceptor/src/lib/caching-headers.enum"; //import { CachingHeaders} from "p3x-interceptor"; import { version } from '../../package.json';
03046eed
13cfe858
@Component({ selector: 'p3x-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent {
5ff05266
671c88f6
public version: string = version;
03046eed
constructor( private http: HttpClient, private snack: MatSnackBar, ) { } async loadCached() { try { const response : any = await this.http.get('https://server.patrikx3.com/api/core/util/random/32').toPromise()
2ad9a9af
this.snack.open(`Will be always the same output: ${response.random}`, 'OK')
03046eed
} catch(e) { this.snack.open(`Sorry, error happened, check the consle for the error`, 'OK') console.error(e) } } async loadNonCached() { try {
2ad9a9af
const response : any = await this.http.get('https://server.patrikx3.com/api/core/util/random/16', {
03046eed
headers: { [CachingHeaders.NoCache]: '1' } }).toPromise() this.snack.open(`Truly random data: ${response.random}`, 'OK') } catch(e) { this.snack.open(`Sorry, error happened, check the console for the error`, 'OK') console.error(e) } }
13cfe858
}