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",
"version": "2.2.1",
"version": "2.2.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
......@@ -8,6 +8,7 @@ import {SocketDataService} from '../dao/socketDataService';
import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
import {ViewModus} from '../dao/viewModus';
import {HttpErrorResponse} from '@angular/common/http';
@Component({
selector: 'app-game',
......@@ -102,10 +103,14 @@ export class GameComponent implements OnInit, OnDestroy {
this.subNewCard = this.socketDataService.getNewCard(this.sessionName)
.pipe(takeUntil(this.ngUnsubscribe))
.subscribe(data => {
this.service.getCard({cardID: data}).then(value => {
this.fillNewCard(value);
this.fillGamestatus();
});
if (data === -1) {
console.log('Öffne POP UP');
} else {
this.service.getCard({cardID: data}).then(value => {
this.fillNewCard(value);
this.fillGamestatus();
});
}
});
this.subEndRound = this.socketDataService.getNewRound(this.sessionName)
.pipe(takeUntil(this.ngUnsubscribe))
......@@ -232,7 +237,12 @@ export class GameComponent implements OnInit, OnDestroy {
if (status) {
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 {
......
......@@ -63,7 +63,11 @@ export class GuesserComponent implements OnInit, OnDestroy {
this.subNewCard = this.socketDataService.getNewCard(this.sessionName)
.pipe(takeUntil(this.ngUnsubscribe))
.subscribe(data => {
this.fillGamestatus();
if (data === -1) {
console.log('Öffne POP UP');
} else {
this.fillGamestatus();
}
});
this.subEndRound = this.socketDataService.getEndRound(this.sessionName)
.pipe(takeUntil(this.ngUnsubscribe))
......
......@@ -8,6 +8,7 @@ import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
import {ViewModus} from '../dao/viewModus';
import {Location} from '@angular/common';
import {HttpErrorResponse} from '@angular/common/http';
@Component({
selector: 'app-overview',
......@@ -207,6 +208,10 @@ export class OverviewComponent implements OnInit, OnDestroy {
const audio = '../../../assets/sounds/state-change_confirm-up.ogg';
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