feat(auth): add user refresh functionality in services
Some checks failed
CI / Get Changed Files (pull_request) Successful in 9s
CI / Docker backend validation (pull_request) Successful in 10s
CI / Docker frontend validation (pull_request) Failing after 36s
CI / oxlint (pull_request) Failing after 27s
CI / eslint (pull_request) Failing after 33s
CI / Checkstyle Main (pull_request) Successful in 46s
CI / prettier (pull_request) Failing after 23s
CI / test-build (pull_request) Failing after 31s

This commit is contained in:
Constantin Simonis 2025-05-07 15:35:33 +02:00
commit 84250969aa
No known key found for this signature in database
GPG key ID: 3878FF77C24AF4D2
3 changed files with 24 additions and 18 deletions

View file

@ -83,7 +83,7 @@ export default class BlackjackComponent implements OnInit {
if (isGameOver) {
console.log('Game is over, state:', game.state);
// this.userService.refreshCurrentUser();
this.userService.refreshCurrentUser();
timer(1500).subscribe(() => {
this.showGameResult.set(true);
console.log('Game result dialog shown after delay');
@ -97,7 +97,7 @@ export default class BlackjackComponent implements OnInit {
this.blackjackService.startGame(bet).subscribe({
next: (game) => {
this.updateGameState(game);
// this.userService.refreshCurrentUser();
this.userService.refreshCurrentUser();
this.isActionInProgress.set(false);
},
error: (error) => {
@ -116,7 +116,7 @@ export default class BlackjackComponent implements OnInit {
next: (game) => {
this.updateGameState(game);
if (game.state !== 'IN_PROGRESS') {
// this.userService.refreshCurrentUser();
this.userService.refreshCurrentUser();
}
this.isActionInProgress.set(false);
},
@ -141,7 +141,7 @@ export default class BlackjackComponent implements OnInit {
this.blackjackService.stand(this.currentGameId()!).subscribe({
next: (game) => {
this.updateGameState(game);
// this.userService.refreshCurrentUser();
this.userService.refreshCurrentUser();
this.isActionInProgress.set(false);
},
error: (error) => {
@ -184,7 +184,7 @@ export default class BlackjackComponent implements OnInit {
onCloseGameResult(): void {
console.log('Closing game result dialog');
this.showGameResult.set(false);
// this.userService.refreshCurrentUser();
this.userService.refreshCurrentUser();
}
onCloseDebtDialog(): void {
@ -195,11 +195,11 @@ export default class BlackjackComponent implements OnInit {
if (error instanceof HttpErrorResponse) {
if (error.status === 400 && error.error?.error === 'Invalid state') {
this.gameInProgress.set(false);
// this.userService.refreshCurrentUser();
this.userService.refreshCurrentUser();
} else if (error.status === 500) {
console.log('Server error occurred. The game may have been updated in another session.');
this.gameInProgress.set(false);
// this.userService.refreshCurrentUser();
this.userService.refreshCurrentUser();
if (this.currentGameId()) {
this.refreshGameState(this.currentGameId()!);
}