Loading src/app/dao/TabuMiddlewareService.ts +5 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,11 @@ export class TabuMiddlewareService { return this.request('GET', `${environment.tabuMiddlewareURL}SpielSession`); } isSpielSession(req: any): Promise<any> { console.log('json: ', req); return this.request('POST', `${environment.tabuMiddlewareURL}isSpielSession`, req); } addSpielSession(event: any): Promise<any> { return this.request('POST', `${environment.tabuMiddlewareURL}addSpielSession`, event); } Loading src/app/select-game/select-game.component.html +2 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,8 @@ </form> </mat-card-content> <mat-card-actions> <button [disabled]="buttonsDisabled" mat-raised-button color="primary" (click)="getSpielSessions()">Spiel erstellen</button> <button [disabled]="buttonsDisabled" mat-raised-button color="primary" (click)="joinGame()">Spiel beitreten</button> <button [disabled]="buttonCreateGameDisabled" mat-raised-button color="primary" (click)="getSpielSessions()">Spiel erstellen</button> <button [disabled]="buttonJoinGameDisabled" mat-raised-button color="primary" (click)="joinGame()">Spiel beitreten</button> </mat-card-actions> </mat-card> </div> src/app/select-game/select-game.component.ts +20 −3 Original line number Diff line number Diff line Loading @@ -9,7 +9,8 @@ import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; }) export class SelectGameComponent implements OnInit { buttonsDisabled = true; buttonCreateGameDisabled = true; buttonJoinGameDisabled = true; constructor(private router: Router, private server: TabuMiddlewareService) { } Loading @@ -36,7 +37,23 @@ export class SelectGameComponent implements OnInit { } checkSpielname(spielname: string): void { console.log(spielname) this.buttonsDisabled = spielname.length === 0; if (spielname.length === 0) { this.buttonCreateGameDisabled = true; this.buttonJoinGameDisabled = true; return; } else { console.log(spielname); this.server.isSpielSession({"spielname": '' + spielname + ''}).then(value => { console.log('Response: ', value.status); const status = JSON.parse(value.status); if (status) { this.buttonCreateGameDisabled = true; this.buttonJoinGameDisabled = false; } else { this.buttonCreateGameDisabled = false; this.buttonJoinGameDisabled = true; } }); } } } Loading
src/app/dao/TabuMiddlewareService.ts +5 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,11 @@ export class TabuMiddlewareService { return this.request('GET', `${environment.tabuMiddlewareURL}SpielSession`); } isSpielSession(req: any): Promise<any> { console.log('json: ', req); return this.request('POST', `${environment.tabuMiddlewareURL}isSpielSession`, req); } addSpielSession(event: any): Promise<any> { return this.request('POST', `${environment.tabuMiddlewareURL}addSpielSession`, event); } Loading
src/app/select-game/select-game.component.html +2 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,8 @@ </form> </mat-card-content> <mat-card-actions> <button [disabled]="buttonsDisabled" mat-raised-button color="primary" (click)="getSpielSessions()">Spiel erstellen</button> <button [disabled]="buttonsDisabled" mat-raised-button color="primary" (click)="joinGame()">Spiel beitreten</button> <button [disabled]="buttonCreateGameDisabled" mat-raised-button color="primary" (click)="getSpielSessions()">Spiel erstellen</button> <button [disabled]="buttonJoinGameDisabled" mat-raised-button color="primary" (click)="joinGame()">Spiel beitreten</button> </mat-card-actions> </mat-card> </div>
src/app/select-game/select-game.component.ts +20 −3 Original line number Diff line number Diff line Loading @@ -9,7 +9,8 @@ import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; }) export class SelectGameComponent implements OnInit { buttonsDisabled = true; buttonCreateGameDisabled = true; buttonJoinGameDisabled = true; constructor(private router: Router, private server: TabuMiddlewareService) { } Loading @@ -36,7 +37,23 @@ export class SelectGameComponent implements OnInit { } checkSpielname(spielname: string): void { console.log(spielname) this.buttonsDisabled = spielname.length === 0; if (spielname.length === 0) { this.buttonCreateGameDisabled = true; this.buttonJoinGameDisabled = true; return; } else { console.log(spielname); this.server.isSpielSession({"spielname": '' + spielname + ''}).then(value => { console.log('Response: ', value.status); const status = JSON.parse(value.status); if (status) { this.buttonCreateGameDisabled = true; this.buttonJoinGameDisabled = false; } else { this.buttonCreateGameDisabled = false; this.buttonJoinGameDisabled = true; } }); } } }