Toggle navigation
P3X GitList Snapshot
GitHub
Repo
Changelog
To do
Releases
Themes
Change log
Loading change log ...
To do ...
Loading todo ...
browsing:
fb5e808b6aaf8f8d0caa99e27b667c9fbdb98f2e
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: 15
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) {
fb5e808b
this.snack.open(`Sorry, error happened, check the console for the error`, 'OK')
03046eed
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
}