style: format code and improve readability
All checks were successful
CI / Get Changed Files (pull_request) Successful in 8s
CI / oxlint (pull_request) Successful in 27s
CI / eslint (pull_request) Successful in 30s
CI / Docker backend validation (pull_request) Successful in 34s
CI / prettier (pull_request) Successful in 38s
CI / Checkstyle Main (pull_request) Successful in 1m1s
CI / Docker frontend validation (pull_request) Successful in 1m2s
CI / test-build (pull_request) Successful in 1m1s
All checks were successful
CI / Get Changed Files (pull_request) Successful in 8s
CI / oxlint (pull_request) Successful in 27s
CI / eslint (pull_request) Successful in 30s
CI / Docker backend validation (pull_request) Successful in 34s
CI / prettier (pull_request) Successful in 38s
CI / Checkstyle Main (pull_request) Successful in 1m1s
CI / Docker frontend validation (pull_request) Successful in 1m2s
CI / test-build (pull_request) Successful in 1m1s
This commit is contained in:
parent
eb1717bca1
commit
f3ab9ffcd6
3 changed files with 9 additions and 8 deletions
|
@ -52,7 +52,7 @@ export const routes: Routes = [
|
|||
),
|
||||
data: { provider: 'google' },
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'game/blackjack',
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Component, computed, inject, OnInit, Signal } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { AuthService } from '@service/auth.service';
|
||||
import { Oauth2Service } from './oauth2.service';
|
||||
|
||||
@Component({
|
||||
|
@ -35,7 +34,9 @@ export class OAuth2CallbackComponent implements OnInit {
|
|||
if (code) {
|
||||
this.oauthService.oauth(provider, code);
|
||||
} else {
|
||||
this.oauthService.error.set('Authentifizierung fehlgeschlagen. Bitte versuchen Sie es erneut.');
|
||||
this.oauthService.error.set(
|
||||
'Authentifizierung fehlgeschlagen. Bitte versuchen Sie es erneut.'
|
||||
);
|
||||
|
||||
setTimeout(() => {
|
||||
this.router.navigate(['/']);
|
||||
|
|
|
@ -2,7 +2,6 @@ import { inject, Injectable, signal } from '@angular/core';
|
|||
import { Router } from '@angular/router';
|
||||
import { AuthService } from '@service/auth.service';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
|
@ -12,16 +11,17 @@ export class Oauth2Service {
|
|||
private _error = signal<string>('');
|
||||
|
||||
oauth(provider: string, code: string) {
|
||||
const oauth$ = provider === 'github'
|
||||
? this.authService.githubAuth(code)
|
||||
: this.authService.googleAuth(code);
|
||||
const oauth$ =
|
||||
provider === 'github' ? this.authService.githubAuth(code) : this.authService.googleAuth(code);
|
||||
|
||||
oauth$.subscribe({
|
||||
next: () => {
|
||||
this.router.navigate(['/home']);
|
||||
},
|
||||
error: (err) => {
|
||||
this._error.set(err.error?.message || 'Authentifizierung fehlgeschlagen. Bitte versuchen Sie es erneut.');
|
||||
this._error.set(
|
||||
err.error?.message || 'Authentifizierung fehlgeschlagen. Bitte versuchen Sie es erneut.'
|
||||
);
|
||||
|
||||
setTimeout(() => {
|
||||
this.router.navigate(['/']);
|
||||
|
|
Reference in a new issue