Commit 1692be1b authored by Dennis Willers's avatar Dennis Willers
Browse files

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

parent 2d1a049e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
{
{
  "name": "tabooh",
  "name": "tabooh",
  "version": "2.2.1",
  "version": "2.2.2",
  "lockfileVersion": 1,
  "lockfileVersion": 1,
  "requires": true,
  "requires": true,
  "dependencies": {
  "dependencies": {
+11 −1
Original line number Original line Diff line number Diff line
@@ -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 {
    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 => {
        if (data === -1) {
          console.log('Öffne POP UP');
        } else {
          this.service.getCard({cardID: data}).then(value => {
          this.service.getCard({cardID: data}).then(value => {
            this.fillNewCard(value);
            this.fillNewCard(value);
            this.fillGamestatus();
            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 {
      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 {
+4 −0
Original line number Original line Diff line number Diff line
@@ -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 => {
        if (data === -1) {
          console.log('Öffne POP UP');
        } else {
          this.fillGamestatus();
          this.fillGamestatus();
        }
      });
      });
    this.subEndRound = this.socketDataService.getEndRound(this.sessionName)
    this.subEndRound = this.socketDataService.getEndRound(this.sessionName)
      .pipe(takeUntil(this.ngUnsubscribe))
      .pipe(takeUntil(this.ngUnsubscribe))
+5 −0
Original line number Original line Diff line number Diff line
@@ -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 {
        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');
      }
    });
    });
  }
  }