This commit is contained in:
programmingPug
2018-03-31 23:08:25 -04:00
parent 7ad3c6b93a
commit c8e94178f8
5 changed files with 70 additions and 2 deletions

View File

@@ -21,6 +21,15 @@ export class GamesService {
private http: HttpClient
){ }
searchGamesByText( searchText ): Observable<any> {
return this.http.get( this.APIURL + "/games?filter=Title,cs," + searchText + "&transform=1" )
.map(res => {
return(
res
);
});
}
getGames( queryFilters, querryPage, queryOrder, queryRecordMax ): Observable<any> {
return this.http.get( this.APIURL + "/games?filter="+ queryFilters +"&page="+ querryPage + "," + queryRecordMax +"&order="+ queryOrder +"&transform=1" )
.map(res => {
@@ -58,7 +67,7 @@ export class GamesService {
}
deleteGameById( gameId ): Observable<any> {
return this.http.get( this.APIURL + "/games/" + gameId )
return this.http.delete( this.APIURL + "/games/" + gameId )
.map(res => {
return(
res
@@ -66,4 +75,19 @@ export class GamesService {
});
}
postFile(fileToUpload: File): Observable<boolean> {
const endpoint = 'your-destination-url';
const formData: FormData = new FormData();
formData.append('fileKey', fileToUpload, fileToUpload.name);
return this.httpClient
.post(endpoint, formData, { headers: yourHeadersConfig })
.map(() => { return true; })
.catch((e) => this.handleError(e));
}
}