image
This commit is contained in:
@@ -31,6 +31,8 @@ if( ( (string)$tokenCheck != (string)$providedToken ) ){
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($_GET['token']);
|
||||||
|
|
||||||
|
|
||||||
interface DatabaseInterface {
|
interface DatabaseInterface {
|
||||||
public function getSql($name);
|
public function getSql($name);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export class GameGridComponent implements OnInit {
|
|||||||
|
|
||||||
getGamesList(): any{
|
getGamesList(): any{
|
||||||
|
|
||||||
this.gameListSubscription = this.gamesService.getGames( this.queryFilters, this.querryPage, this.queryOrder, this.pageSize ).subscribe( data => {
|
this.gameListSubscription = this.gamesService.getGames( this.queryFilters, this.querryPage, this.queryOrder, this.pageSize, this.currentUser.id ).subscribe( data => {
|
||||||
this.length = data["_results"];
|
this.length = data["_results"];
|
||||||
this.gamesData = data.games;
|
this.gamesData = data.games;
|
||||||
});
|
});
|
||||||
@@ -53,7 +53,7 @@ export class GameGridComponent implements OnInit {
|
|||||||
|
|
||||||
onKey( event: any ){
|
onKey( event: any ){
|
||||||
if( event.target.value != "" ){
|
if( event.target.value != "" ){
|
||||||
this.gamesService.searchGamesByText( event.target.value ).subscribe( data => {
|
this.gamesService.searchGamesByText( event.target.value, this.currentUser.token, this.currentUser.id ).subscribe( data => {
|
||||||
this.gamesData = data.games;
|
this.gamesData = data.games;
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ export class GamesService {
|
|||||||
private http: HttpClient
|
private http: HttpClient
|
||||||
){ }
|
){ }
|
||||||
|
|
||||||
searchGamesByText( searchText ): Observable<any> {
|
searchGamesByText( searchText, userToken, userId ): Observable<any> {
|
||||||
return this.http.get( this.APIURL + "/games?filter=Title,cs," + searchText + "&transform=1" )
|
return this.http.get( this.APIURL + "/games?filter[]=Title,cs," + searchText + "&filter[]=userId,eq,"+ userId + "&transform=1&transform=1&token=" + userToken )
|
||||||
.map(res => {
|
.map(res => {
|
||||||
return(
|
return(
|
||||||
res
|
res
|
||||||
@@ -35,9 +35,9 @@ export class GamesService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getGames( queryFilters, querryPage, queryOrder, queryRecordMax ): Observable<any> {
|
getGames( queryFilters, querryPage, queryOrder, queryRecordMax, userId ): Observable<any> {
|
||||||
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
||||||
return this.http.get( this.APIURL + "/games?filter="+ queryFilters +"&page="+ querryPage + "," + queryRecordMax +"&order="+ queryOrder +"&transform=1&token=" + currentUser.token )
|
return this.http.get( this.APIURL + "/games?filter[]=" + queryFilters + "&filter[]=userId,eq,"+ userId + " &page="+ querryPage + "," + queryRecordMax +"&order="+ queryOrder +"&transform=1&token=" + currentUser.token )
|
||||||
.map(res => {
|
.map(res => {
|
||||||
return(
|
return(
|
||||||
res
|
res
|
||||||
@@ -54,8 +54,8 @@ export class GamesService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getGameById( gameId ): Observable<any> {
|
getGameById( gameId, userToken, userId ): Observable<any> {
|
||||||
return this.http.get( this.APIURL + "/games/" + gameId )
|
return this.http.get( this.APIURL + "/games/" + gameId + "?filter[]=userId,eq,"+ userId + "&token=" + userToken)
|
||||||
.map(res => {
|
.map(res => {
|
||||||
return(
|
return(
|
||||||
res
|
res
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12" id="gameImageHeaderContainer">
|
<div class="col-sm-12" id="gameImageHeaderContainer">
|
||||||
<img class="card-img-top" src="http://lazypug.net/globalAssets/images/temp1.png" alt="">
|
<img class="card-img-top" [src]="imageSample" alt="">
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ export class ViewCardComponent implements OnInit {
|
|||||||
gameData: Game;
|
gameData: Game;
|
||||||
form: any;
|
form: any;
|
||||||
fileToUpload: File = null;
|
fileToUpload: File = null;
|
||||||
|
imageSample = "http://lazypug.net/globalAssets/images/temp1.png";
|
||||||
|
|
||||||
|
currentUser;
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -28,9 +31,10 @@ export class ViewCardComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
this.gid = this.route.snapshot.paramMap.get('gid');
|
this.gid = this.route.snapshot.paramMap.get('gid');
|
||||||
|
this.currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
||||||
|
|
||||||
if( this.gid != null ){
|
if( this.gid != null ){
|
||||||
this.gameSubscription = this.gamesService.getGameById( this.gid ).subscribe( data => {
|
this.gameSubscription = this.gamesService.getGameById( this.gid, this.currentUser.token, this.currentUser.id ).subscribe( data => {
|
||||||
this.gameData = data;
|
this.gameData = data;
|
||||||
this.buildForm();
|
this.buildForm();
|
||||||
});
|
});
|
||||||
@@ -87,9 +91,18 @@ export class ViewCardComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleFileInput( $event ) {
|
handleFileInput( $event ) {
|
||||||
|
if ($event.target.files && $event.target.files[0]) {
|
||||||
this.fileToUpload = $event.target.files[0];
|
var reader = new FileReader();
|
||||||
this.uploadFileToActivity();
|
reader.onload = (event:any) => {
|
||||||
|
console.log( event.target.result );
|
||||||
|
this.imageSample = event.target.result;
|
||||||
|
//$('#blah').attr('src', e.target.result);
|
||||||
|
};
|
||||||
|
//console.log($event.target.files[0]);
|
||||||
|
reader.readAsDataURL( $event.target.files[0] );
|
||||||
|
}
|
||||||
|
//this.fileToUpload = $event.target.files[0];
|
||||||
|
//this.uploadFileToActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadFileToActivity() {
|
uploadFileToActivity() {
|
||||||
|
|||||||
Reference in New Issue
Block a user