day one build
This commit is contained in:
33
src/app/games.service.ts
Normal file
33
src/app/games.service.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/operator/map';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' })
|
||||
//headers: new HttpHeaders({ 'Content-Type': 'application/json' })
|
||||
}
|
||||
|
||||
const httpOptionsPut = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class GamesService {
|
||||
|
||||
APIURL = "http://www.lazypug.net/api.php";
|
||||
|
||||
constructor(
|
||||
private http: HttpClient
|
||||
){ }
|
||||
|
||||
getGames( ): Observable<any> {
|
||||
return this.http.get( this.APIURL + "/games?filter=Played,eq,true&page=1&order=Title&transform=1" )
|
||||
.map(res => {
|
||||
return(
|
||||
res
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user