From 401a3979459132b60548c644102faa09055e956e Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Tue, 18 Oct 2022 20:48:11 +0300 Subject: [PATCH] add fake game for browser development --- .../games-bar/games-bar.component.ts | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/app/components/games-bar/games-bar.component.ts b/src/app/components/games-bar/games-bar.component.ts index 6a0e11f..c57cb42 100644 --- a/src/app/components/games-bar/games-bar.component.ts +++ b/src/app/components/games-bar/games-bar.component.ts @@ -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] + } + }); + } + } }