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' },
|
data: { provider: 'google' },
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'game/blackjack',
|
path: 'game/blackjack',
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Component, computed, inject, OnInit, Signal } from '@angular/core';
|
import { Component, computed, inject, OnInit, Signal } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { AuthService } from '@service/auth.service';
|
|
||||||
import { Oauth2Service } from './oauth2.service';
|
import { Oauth2Service } from './oauth2.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -35,7 +34,9 @@ export class OAuth2CallbackComponent implements OnInit {
|
||||||
if (code) {
|
if (code) {
|
||||||
this.oauthService.oauth(provider, code);
|
this.oauthService.oauth(provider, code);
|
||||||
} else {
|
} else {
|
||||||
this.oauthService.error.set('Authentifizierung fehlgeschlagen. Bitte versuchen Sie es erneut.');
|
this.oauthService.error.set(
|
||||||
|
'Authentifizierung fehlgeschlagen. Bitte versuchen Sie es erneut.'
|
||||||
|
);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { inject, Injectable, signal } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { AuthService } from '@service/auth.service';
|
import { AuthService } from '@service/auth.service';
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
|
@ -12,16 +11,17 @@ export class Oauth2Service {
|
||||||
private _error = signal<string>('');
|
private _error = signal<string>('');
|
||||||
|
|
||||||
oauth(provider: string, code: string) {
|
oauth(provider: string, code: string) {
|
||||||
const oauth$ = provider === 'github'
|
const oauth$ =
|
||||||
? this.authService.githubAuth(code)
|
provider === 'github' ? this.authService.githubAuth(code) : this.authService.googleAuth(code);
|
||||||
: this.authService.googleAuth(code);
|
|
||||||
|
|
||||||
oauth$.subscribe({
|
oauth$.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.router.navigate(['/home']);
|
this.router.navigate(['/home']);
|
||||||
},
|
},
|
||||||
error: (err) => {
|
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(() => {
|
setTimeout(() => {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
|
|
Reference in a new issue