diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index d32e722..aa232ac 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -1,7 +1,7 @@ -import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterOutlet } from '@angular/router'; -import { FooterComponent } from './shared/components/footer/footer.component'; +import { FooterComponent } from '@shared/components/footer/footer.component'; @Component({ selector: 'app-root', @@ -12,10 +12,5 @@ import { FooterComponent } from './shared/components/footer/footer.component'; styleUrl: './app.component.css', changeDetection: ChangeDetectionStrategy.OnPush, }) -export class AppComponent implements OnInit { - ngOnInit() { - const count = +(localStorage.getItem('reloadCount') ?? 0); - localStorage.setItem('reloadCount', (count + 1).toString()); - console.log('Reload count from localStorage:', count + 1); - } +export class AppComponent { } diff --git a/frontend/src/app/feature/auth/login/login.component.html b/frontend/src/app/feature/auth/login/login.component.html new file mode 100644 index 0000000..184cc6d --- /dev/null +++ b/frontend/src/app/feature/auth/login/login.component.html @@ -0,0 +1,71 @@ + +
+
+

Login to Casino

+ +
+ {{ errorMessage }} +
+ +
+
+ + + +
+ Username or email is required +
+
+ +
+ + + +
+ Password is required +
+
+ +
+ +
+
+ +
+

+ Don't have an account? + Register +

+
+
+
diff --git a/frontend/src/app/feature/auth/login/login.component.ts b/frontend/src/app/feature/auth/login/login.component.ts index 1e63b7f..1ed3537 100644 --- a/frontend/src/app/feature/auth/login/login.component.ts +++ b/frontend/src/app/feature/auth/login/login.component.ts @@ -9,78 +9,7 @@ import { CommonModule } from '@angular/common'; selector: 'app-login', standalone: true, imports: [CommonModule, ReactiveFormsModule, RouterLink], - template: ` -
-
-

Login to Casino

- -
- {{ errorMessage }} -
- -
-
- - - -
- Username or email is required -
-
- -
- - - -
- Password is required -
-
- -
- -
-
- -
-

- Don't have an account? - Register -

-
-
-
- `, + templateUrl: './login.component.html', }) export class LoginComponent { loginForm: FormGroup; diff --git a/frontend/src/app/feature/auth/register/register.component.html b/frontend/src/app/feature/auth/register/register.component.html new file mode 100644 index 0000000..ed02f07 --- /dev/null +++ b/frontend/src/app/feature/auth/register/register.component.html @@ -0,0 +1,93 @@ +
+
+

Create Account

+ +
+ {{ errorMessage }} +
+ +
+
+ + + +
+ Email is required + Please enter a valid email address +
+
+ +
+ + + +
+ Username is required + Username must be at least 3 characters +
+
+ +
+ + + +
+ Password is required + Password must be at least 6 characters +
+
+ +
+ +
+
+ +
+

+ Already have an account? + Login +

+
+
+
diff --git a/frontend/src/app/feature/auth/register/register.component.ts b/frontend/src/app/feature/auth/register/register.component.ts index 5b3f4d1..22a032f 100644 --- a/frontend/src/app/feature/auth/register/register.component.ts +++ b/frontend/src/app/feature/auth/register/register.component.ts @@ -2,108 +2,14 @@ import { Component } from '@angular/core'; import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; import { Router, RouterLink } from '@angular/router'; import { RegisterRequest } from '../../../model/auth/RegisterRequest'; -import { AuthService } from '../../../service/auth.service'; +import { AuthService } from '@service/auth.service'; import { CommonModule } from '@angular/common'; @Component({ selector: 'app-register', standalone: true, imports: [CommonModule, ReactiveFormsModule, RouterLink], - template: ` -
-
-

Create Account

- -
- {{ errorMessage }} -
- -
-
- - - -
- Email is required - Please enter a valid email address -
-
- -
- - - -
- Username is required - Username must be at least 3 characters -
-
- -
- - - -
- Password is required - Password must be at least 6 characters -
-
- -
- -
-
- -
-

- Already have an account? - Login -

-
-
-
- `, + templateUrl: './register.component.html', }) export class RegisterComponent { registerForm: FormGroup; @@ -152,7 +58,7 @@ export class RegisterComponent { next: () => { this.router.navigate(['/home']); }, - error: (err) => { + error: () => { this.isLoading = false; this.errorMessage = 'Registration successful but failed to login automatically. Please log in manually.'; diff --git a/frontend/src/app/service/auth.service.ts b/frontend/src/app/service/auth.service.ts index 7880000..1a118cd 100644 --- a/frontend/src/app/service/auth.service.ts +++ b/frontend/src/app/service/auth.service.ts @@ -30,10 +30,7 @@ export class AuthService { // Check if token exists and load user data if (this.getToken()) { - console.log('Token found, loading user data...'); this.loadCurrentUser(); - } else { - console.log('No token found, user not logged in.'); } } @@ -88,8 +85,7 @@ export class AuthService { next: (user) => { this.setUser(user); }, - error: (e) => { - console.log(e); + error: () => { this.logout(); }, });