add fake sessions

This commit is contained in:
cyber-dream 2022-10-28 18:37:45 +03:00
parent 3c10b1d9ee
commit c6dfb09213

View File

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Session } from 'projects/ui/src/lib/interfaces/session'; import { Session } from 'src/app/interfaces/session.interface';
import { GoGetSessions } from 'src/app/services/go';
@Component({ @Component({
selector: 'app-menu-sessions', selector: 'app-menu-sessions',
@ -7,9 +8,9 @@ import { Session } from 'projects/ui/src/lib/interfaces/session';
styleUrls: ['./menu-sessions.component.scss'], styleUrls: ['./menu-sessions.component.scss'],
}) })
export class MenuSessionsComponent implements OnInit { export class MenuSessionsComponent implements OnInit {
sessions: Session[] = [ fakeSessions: Session[] = [
{ {
id: 'minecraft-001', gameId: 'minecraft-001',
icon: '/assets/games/minecraft/icon.png', icon: '/assets/games/minecraft/icon.png',
title: 'Minecraft', title: 'Minecraft',
version: '1.19.2', version: '1.19.2',
@ -17,22 +18,32 @@ export class MenuSessionsComponent implements OnInit {
expires: new Date('2022-10-30'), expires: new Date('2022-10-30'),
}, },
{ {
id: 'minecraft-002', gameId: 'minecraft-002',
icon: '/assets/games/garrysmod/icon.png', icon: '/assets/games/garrysmod/icon.png',
title: 'Minecraft 2', title: 'Minecraft 2',
version: '1.12-dev', version: '1.12-dev',
expires: new Date('2022-10-27T20:00:00'), expires: new Date('2022-10-27T20:00:00'),
}, },
{ {
id: 'minecraft-003', gameId: 'minecraft-003',
icon: '/assets/games/minecraft/icon.png', icon: '/assets/games/minecraft/icon.png',
title: 'Minecraft 3', title: 'Minecraft 3',
version: '1.7.10', version: '1.7.10',
expires: new Date('2022-10-30T20:00:00'), expires: new Date('2022-10-30T20:00:00'),
}, },
]; ];
sessions: Session[] = [];
constructor() {} constructor() {}
ngOnInit(): void {} ngOnInit(): void {
if(GoGetSessions == undefined){
this.sessions = this.fakeSessions
}
else {
GoGetSessions().then((value) => {
this.sessions = value
})
}
}
} }