Commit 1692be1b authored by Dennis Willers's avatar Dennis Willers 🏀

If new Card is -1 a POP-Up which needs to be implemented should pop up. Watching for Error 502

parent 2d1a049e
Pipeline #401 passed with stage
in 5 minutes and 17 seconds
{ {
"name": "tabooh", "name": "tabooh",
"version": "2.2.1", "version": "2.2.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
......
...@@ -8,6 +8,7 @@ import {SocketDataService} from '../dao/socketDataService'; ...@@ -8,6 +8,7 @@ import {SocketDataService} from '../dao/socketDataService';
import {Subject} from 'rxjs'; import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators'; import {takeUntil} from 'rxjs/operators';
import {ViewModus} from '../dao/viewModus'; import {ViewModus} from '../dao/viewModus';
import {HttpErrorResponse} from '@angular/common/http';
@Component({ @Component({
selector: 'app-game', selector: 'app-game',
...@@ -102,10 +103,14 @@ export class GameComponent implements OnInit, OnDestroy { ...@@ -102,10 +103,14 @@ export class GameComponent implements OnInit, OnDestroy {
this.subNewCard = this.socketDataService.getNewCard(this.sessionName) this.subNewCard = this.socketDataService.getNewCard(this.sessionName)
.pipe(takeUntil(this.ngUnsubscribe)) .pipe(takeUntil(this.ngUnsubscribe))
.subscribe(data => { .subscribe(data => {
this.service.getCard({cardID: data}).then(value => { if (data === -1) {
this.fillNewCard(value); console.log('Öffne POP UP');
this.fillGamestatus(); } else {
}); this.service.getCard({cardID: data}).then(value => {
this.fillNewCard(value);
this.fillGamestatus();
});
}
}); });
this.subEndRound = this.socketDataService.getNewRound(this.sessionName) this.subEndRound = this.socketDataService.getNewRound(this.sessionName)
.pipe(takeUntil(this.ngUnsubscribe)) .pipe(takeUntil(this.ngUnsubscribe))
...@@ -232,7 +237,12 @@ export class GameComponent implements OnInit, OnDestroy { ...@@ -232,7 +237,12 @@ export class GameComponent implements OnInit, OnDestroy {
if (status) { if (status) {
this.fillNewCard(value); this.fillNewCard(value);
} }
}).catch(reason => console.log(reason)); }).catch((err: HttpErrorResponse) => {
console.log(err);
if (err.status === 502) {
console.log('Keine neuen Karten mehr');
}
});
} }
fillNewCard(value: any): void { fillNewCard(value: any): void {
......
...@@ -63,7 +63,11 @@ export class GuesserComponent implements OnInit, OnDestroy { ...@@ -63,7 +63,11 @@ export class GuesserComponent implements OnInit, OnDestroy {
this.subNewCard = this.socketDataService.getNewCard(this.sessionName) this.subNewCard = this.socketDataService.getNewCard(this.sessionName)
.pipe(takeUntil(this.ngUnsubscribe)) .pipe(takeUntil(this.ngUnsubscribe))
.subscribe(data => { .subscribe(data => {
this.fillGamestatus(); if (data === -1) {
console.log('Öffne POP UP');
} else {
this.fillGamestatus();
}
}); });
this.subEndRound = this.socketDataService.getEndRound(this.sessionName) this.subEndRound = this.socketDataService.getEndRound(this.sessionName)
.pipe(takeUntil(this.ngUnsubscribe)) .pipe(takeUntil(this.ngUnsubscribe))
......
...@@ -8,6 +8,7 @@ import {Subject} from 'rxjs'; ...@@ -8,6 +8,7 @@ import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators'; import {takeUntil} from 'rxjs/operators';
import {ViewModus} from '../dao/viewModus'; import {ViewModus} from '../dao/viewModus';
import {Location} from '@angular/common'; import {Location} from '@angular/common';
import {HttpErrorResponse} from '@angular/common/http';
@Component({ @Component({
selector: 'app-overview', selector: 'app-overview',
...@@ -207,6 +208,10 @@ export class OverviewComponent implements OnInit, OnDestroy { ...@@ -207,6 +208,10 @@ export class OverviewComponent implements OnInit, OnDestroy {
const audio = '../../../assets/sounds/state-change_confirm-up.ogg'; const audio = '../../../assets/sounds/state-change_confirm-up.ogg';
this.playAudio(audio); this.playAudio(audio);
}); });
}).catch((err: HttpErrorResponse) => {
if (err.status === 502) {
console.log('POP UP HIER ÖFFNEN');
}
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment