diff --git a/frontend/src/app/Services/auth.service.ts b/frontend/src/app/Services/auth.service.ts index db051dc..4fcdef9 100644 --- a/frontend/src/app/Services/auth.service.ts +++ b/frontend/src/app/Services/auth.service.ts @@ -12,14 +12,14 @@ const httpOptions = { export class AuthService { constructor(private http: HttpClient) {} login(username: string, password: string): Observable { - return this.http.post(AUTH_API + 'login', { + return this.http.post(AUTH_API + '/login', { username, password, }); } register(username: string, password: string): Observable { return this.http.post( - AUTH_API + 'signup', + AUTH_API + '/register', { username, password, diff --git a/frontend/src/app/Services/data.service.ts b/frontend/src/app/Services/data.service.ts index ce44a05..f47d80e 100644 --- a/frontend/src/app/Services/data.service.ts +++ b/frontend/src/app/Services/data.service.ts @@ -1,22 +1,22 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; -const API_URL = 'http://localhost:8080/api/test/'; +const API_URL = 'https://aktienbot.flokaiser.com/api/user'; @Injectable({ providedIn: 'root', }) export class DataService { constructor(private http: HttpClient) {} - // getPublicContent(): Observable { - // return this.http.get(API_URL + 'all', { responseType: 'text' }); - // } - // getUserBoard(): Observable { - // return this.http.get(API_URL + 'user', { responseType: 'text' }); - // } - // getModeratorBoard(): Observable { - // return this.http.get(API_URL + 'mod', { responseType: 'text' }); - // } - // getAdminBoard(): Observable { - // return this.http.get(API_URL + 'admin', { responseType: 'text' }); - // } + getPublicContent(): Observable { + return this.http.get(API_URL + 'all', { responseType: 'text' }); + } + getUserBoard(): Observable { + return this.http.get(API_URL + 'user', { responseType: 'text' }); + } + getModeratorBoard(): Observable { + return this.http.get(API_URL + 'mod', { responseType: 'text' }); + } + getAdminBoard(): Observable { + return this.http.get(API_URL + 'admin', { responseType: 'text' }); + } } diff --git a/frontend/src/app/Views/register/register.component.html b/frontend/src/app/Views/register/register.component.html index 2e2c38c..486f037 100644 --- a/frontend/src/app/Views/register/register.component.html +++ b/frontend/src/app/Views/register/register.component.html @@ -53,6 +53,23 @@ +
+ + +
+
+ Confirmation is required +
+
+
diff --git a/frontend/src/app/Views/register/register.component.ts b/frontend/src/app/Views/register/register.component.ts index 728792b..b015e29 100644 --- a/frontend/src/app/Views/register/register.component.ts +++ b/frontend/src/app/Views/register/register.component.ts @@ -21,7 +21,6 @@ export class RegisterComponent implements OnInit { const { username, password } = this.form; this.authService.register(username, password).subscribe( (data) => { - console.log(data); this.isSuccessful = true; this.isSignUpFailed = false; this.router.navigate(['/login']); diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index 2cb0777..e3465f6 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -33,17 +33,17 @@ export class AppComponent { (event as NavigationEnd).url === '/login' || (event as NavigationEnd).url === '/register' ); - // if (this.tokenStorage.getToken()) { - // this.isLoggedIn = true; - // } else { - // this.isLoggedIn = false; - // } - // if ( - // this.isLoggedIn === false && - // (event as NavigationEnd).url != '/register' - // ) { - // this.router.navigate(['/login']); - // } + if (this.tokenStorage.getToken()) { + this.isLoggedIn = true; + } else { + this.isLoggedIn = false; + } + if ( + this.isLoggedIn === false && + (event as NavigationEnd).url != '/register' + ) { + this.router.navigate(['/login']); + } }); } }