style: format code for consistency and readability
All checks were successful
All checks were successful
This commit is contained in:
parent
e983b21e07
commit
4a7c54eab8
3 changed files with 18 additions and 10 deletions
|
@ -106,7 +106,8 @@ export class GameResultComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
getResultMessage(): string {
|
getResultMessage(): string {
|
||||||
if (this.gameState === GameState.PLAYER_BLACKJACK) return 'Glückwunsch! Du hast mit einem Blackjack gewonnen!';
|
if (this.gameState === GameState.PLAYER_BLACKJACK)
|
||||||
|
return 'Glückwunsch! Du hast mit einem Blackjack gewonnen!';
|
||||||
if (this.isWin) return 'Glückwunsch! Du hast diese Runde gewonnen.';
|
if (this.isWin) return 'Glückwunsch! Du hast diese Runde gewonnen.';
|
||||||
if (this.isLoss) return 'Schade! Du hast diese Runde verloren.';
|
if (this.isLoss) return 'Schade! Du hast diese Runde verloren.';
|
||||||
if (this.isDraw) return 'Diese Runde endet unentschieden. Dein Einsatz wurde zurückgegeben.';
|
if (this.isDraw) return 'Diese Runde endet unentschieden. Dein Einsatz wurde zurückgegeben.';
|
||||||
|
|
|
@ -20,14 +20,14 @@ export class UserService {
|
||||||
public getUser(id: string): Observable<User | null> {
|
public getUser(id: string): Observable<User | null> {
|
||||||
return this.http.get<User | null>(`/backend/user/${id}`).pipe(
|
return this.http.get<User | null>(`/backend/user/${id}`).pipe(
|
||||||
catchError(() => EMPTY),
|
catchError(() => EMPTY),
|
||||||
tap(user => this.currentUserSubject.next(user))
|
tap((user) => this.currentUserSubject.next(user))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCurrentUser(): Observable<User | null> {
|
public getCurrentUser(): Observable<User | null> {
|
||||||
return this.http.get<User | null>('/backend/user').pipe(
|
return this.http.get<User | null>('/backend/user').pipe(
|
||||||
catchError(() => EMPTY),
|
catchError(() => EMPTY),
|
||||||
tap(user => this.currentUserSubject.next(user))
|
tap((user) => this.currentUserSubject.next(user))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ export class UserService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public createUser(id: string, username: string): Observable<User> {
|
public createUser(id: string, username: string): Observable<User> {
|
||||||
return this.http.post<User>('/backend/user', {
|
return this.http
|
||||||
|
.post<User>('/backend/user', {
|
||||||
keycloakId: id,
|
keycloakId: id,
|
||||||
username: username,
|
username: username,
|
||||||
}).pipe(
|
})
|
||||||
tap(user => this.currentUserSubject.next(user))
|
.pipe(tap((user) => this.currentUserSubject.next(user)));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getOrCreateUser(userProfile: KeycloakProfile) {
|
public async getOrCreateUser(userProfile: KeycloakProfile) {
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
import { ChangeDetectionStrategy, Component, inject, OnInit, OnDestroy, signal } from '@angular/core';
|
import {
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
inject,
|
||||||
|
OnInit,
|
||||||
|
OnDestroy,
|
||||||
|
signal,
|
||||||
|
} from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { KeycloakService } from 'keycloak-angular';
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { CurrencyPipe } from '@angular/common';
|
import { CurrencyPipe } from '@angular/common';
|
||||||
|
|
Reference in a new issue