add fake game for browser development

This commit is contained in:
cyber-dream 2022-10-18 20:48:11 +03:00
parent 902dca5cc2
commit 401a397945

View File

@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { Game } from 'src/app/interfaces/game.interface';
import { GetGames } from 'src/app/services/go';
@ -18,12 +19,25 @@ export class GamesBarComponent implements OnInit {
}
getGames() {
GetGames().then((value) => {
console.log(value);
this.games = value;
if (this.games.length > 0){
this.activeGame = this.games[0]
if (GetGames == undefined){
var fakeGame: Game = {
gameId: "Fake Game",
title: "Fake game",
description: "asdasdasd",
image: "gmod.png"
}
});
this.games.push(fakeGame)
this.activeGame = this.games[0]
}
else{
GetGames().then((value) => {
console.log(value);
this.games = value;
if (this.games.length > 0){
this.activeGame = this.games[0]
}
});
}
}
}