Loading src/app/app-routing.module.ts +1 −1 Original line number Original line Diff line number Diff line Loading @@ -7,7 +7,7 @@ import {GameComponent} from './game/game.component'; const routes: Routes = [ const routes: Routes = [ { { path: 'overview', path: 'game/:sessionName/overview', component: OverviewComponent, component: OverviewComponent, }, }, { { Loading src/app/dao/TabuMiddlewareService.ts +3 −3 Original line number Original line Diff line number Diff line Loading @@ -27,11 +27,11 @@ export class TabuMiddlewareService { } } isSpielSession(req: any): Promise<any> { isSpielSession(req: any): Promise<any> { console.log('json: ', req); return this.request('POST', `${environment.tabuMiddlewareURL}isSpielSession`, req); return this.request('POST', `${environment.tabuMiddlewareURL}isSpielSession`, req); } } addSpielSession(event: any): Promise<any> { addSpielSession(req: any): Promise<any> { return this.request('POST', `${environment.tabuMiddlewareURL}addSpielSession`, event); console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}addSpielSession`, req); } } } } src/app/select-game/select-game.component.html +2 −2 Original line number Original line Diff line number Diff line Loading @@ -18,8 +18,8 @@ </form> </form> </mat-card-content> </mat-card-content> <mat-card-actions> <mat-card-actions> <button [disabled]="buttonCreateGameDisabled" mat-raised-button color="primary" (click)="getSpielSessions()">Spiel erstellen</button> <button [disabled]="buttonCreateGameDisabled" mat-raised-button color="primary" (click)="createGame(spielname.value)">Spiel erstellen</button> <button [disabled]="buttonJoinGameDisabled" mat-raised-button color="primary" (click)="joinGame()">Spiel beitreten</button> <button [disabled]="buttonJoinGameDisabled" mat-raised-button color="primary" (click)="joinGame(spielname.value)">Spiel beitreten</button> </mat-card-actions> </mat-card-actions> </mat-card> </mat-card> </div> </div> src/app/select-game/select-game.component.ts +16 −4 Original line number Original line Diff line number Diff line Loading @@ -23,8 +23,21 @@ export class SelectGameComponent implements OnInit { console.log('Response:', response); console.log('Response:', response); } } joinGame(): void { createGame(spielname: string): void { this.router.navigate(['/overview']); this.server.addSpielSession({"spielname": '' + spielname + ''}).then(value => { console.log(value); const status = JSON.parse(value.status); if (status) { this.router.navigate(['/game/' + spielname + '/overview']); } }).catch(reason => { console.log(reason); console.log('Es ist ein Fehler aufgetreten beim Erstellen eines neuen Spiels'); }); } joinGame(spielname: string): void { this.router.navigate(['/game/' + spielname + '/overview']); } } keyPressAlphaNumeric(event: KeyboardEvent): boolean { keyPressAlphaNumeric(event: KeyboardEvent): boolean { Loading @@ -42,8 +55,7 @@ export class SelectGameComponent implements OnInit { this.buttonJoinGameDisabled = true; this.buttonJoinGameDisabled = true; return; return; } else { } else { console.log(spielname); this.server.isSpielSession({'spielname': spielname}).then(value => { this.server.isSpielSession({"spielname": '' + spielname + ''}).then(value => { console.log('Response: ', value.status); console.log('Response: ', value.status); const status = JSON.parse(value.status); const status = JSON.parse(value.status); if (status) { if (status) { Loading Loading
src/app/app-routing.module.ts +1 −1 Original line number Original line Diff line number Diff line Loading @@ -7,7 +7,7 @@ import {GameComponent} from './game/game.component'; const routes: Routes = [ const routes: Routes = [ { { path: 'overview', path: 'game/:sessionName/overview', component: OverviewComponent, component: OverviewComponent, }, }, { { Loading
src/app/dao/TabuMiddlewareService.ts +3 −3 Original line number Original line Diff line number Diff line Loading @@ -27,11 +27,11 @@ export class TabuMiddlewareService { } } isSpielSession(req: any): Promise<any> { isSpielSession(req: any): Promise<any> { console.log('json: ', req); return this.request('POST', `${environment.tabuMiddlewareURL}isSpielSession`, req); return this.request('POST', `${environment.tabuMiddlewareURL}isSpielSession`, req); } } addSpielSession(event: any): Promise<any> { addSpielSession(req: any): Promise<any> { return this.request('POST', `${environment.tabuMiddlewareURL}addSpielSession`, event); console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}addSpielSession`, req); } } } }
src/app/select-game/select-game.component.html +2 −2 Original line number Original line Diff line number Diff line Loading @@ -18,8 +18,8 @@ </form> </form> </mat-card-content> </mat-card-content> <mat-card-actions> <mat-card-actions> <button [disabled]="buttonCreateGameDisabled" mat-raised-button color="primary" (click)="getSpielSessions()">Spiel erstellen</button> <button [disabled]="buttonCreateGameDisabled" mat-raised-button color="primary" (click)="createGame(spielname.value)">Spiel erstellen</button> <button [disabled]="buttonJoinGameDisabled" mat-raised-button color="primary" (click)="joinGame()">Spiel beitreten</button> <button [disabled]="buttonJoinGameDisabled" mat-raised-button color="primary" (click)="joinGame(spielname.value)">Spiel beitreten</button> </mat-card-actions> </mat-card-actions> </mat-card> </mat-card> </div> </div>
src/app/select-game/select-game.component.ts +16 −4 Original line number Original line Diff line number Diff line Loading @@ -23,8 +23,21 @@ export class SelectGameComponent implements OnInit { console.log('Response:', response); console.log('Response:', response); } } joinGame(): void { createGame(spielname: string): void { this.router.navigate(['/overview']); this.server.addSpielSession({"spielname": '' + spielname + ''}).then(value => { console.log(value); const status = JSON.parse(value.status); if (status) { this.router.navigate(['/game/' + spielname + '/overview']); } }).catch(reason => { console.log(reason); console.log('Es ist ein Fehler aufgetreten beim Erstellen eines neuen Spiels'); }); } joinGame(spielname: string): void { this.router.navigate(['/game/' + spielname + '/overview']); } } keyPressAlphaNumeric(event: KeyboardEvent): boolean { keyPressAlphaNumeric(event: KeyboardEvent): boolean { Loading @@ -42,8 +55,7 @@ export class SelectGameComponent implements OnInit { this.buttonJoinGameDisabled = true; this.buttonJoinGameDisabled = true; return; return; } else { } else { console.log(spielname); this.server.isSpielSession({'spielname': spielname}).then(value => { this.server.isSpielSession({"spielname": '' + spielname + ''}).then(value => { console.log('Response: ', value.status); console.log('Response: ', value.status); const status = JSON.parse(value.status); const status = JSON.parse(value.status); if (status) { if (status) { Loading