fix: NCWF-1 401 (#6)

Co-authored-by: shahdlala66 <shahd.lala66@gmail.com>
Co-authored-by: Lala, Shahd <Shahd.Lala@sybit.de>
Reviewed-on: #6
This commit was merged in pull request #6.
This commit is contained in:
2026-05-13 00:01:26 +02:00
parent ac4fe8b005
commit 6d1e06dfd6
4 changed files with 58 additions and 36 deletions
+13 -24
View File
@@ -67,6 +67,7 @@ export class WelcomeComponent implements OnInit, OnDestroy {
showOptionsDialog = false;
showJoinDialog = false;
showImportDialog = false;
showChallengeDialog = false;
gameIdInput = '';
importMode: ImportMode = 'fen';
@@ -223,11 +224,21 @@ export class WelcomeComponent implements OnInit, OnDestroy {
}
startOneVsOne(): void {
if (!this.requireAuth(() => this.performStartOneVsOne())) {
if (!this.requireAuth(() => this.openChallengeDialog())) {
return;
}
this.performStartOneVsOne();
this.openChallengeDialog();
}
openChallengeDialog(): void {
this.closeAllDialogs();
this.showChallengeDialog = true;
}
closeChallengeDialog(): void {
this.showChallengeDialog = false;
this.errorMessage = '';
}
startVsBot(difficulty: Difficulty): void {
@@ -352,28 +363,6 @@ export class WelcomeComponent implements OnInit, OnDestroy {
action();
}
private performStartOneVsOne(): void {
if (this.creating) {
return;
}
this.errorMessage = '';
this.creating = true;
this.gameApi
.createGame()
.pipe(finalize(() => (this.creating = false)))
.subscribe({
next: (game) => {
void this.router.navigate(['/game', game.gameId], {
state: { theme: this.isSunsetMode ? 'light' : 'dark' }
});
},
error: (error) => {
this.errorMessage = getErrorMessage(error, 'Unable to create a game.');
}
});
}
private performStartVsBot(difficulty: Difficulty): void {
if (this.creating) {