fix: 500 when loggin in

This commit is contained in:
Constantin Simonis 2025-02-19 11:59:36 +01:00
parent 5afdbad461
commit a091387c1c
No known key found for this signature in database
GPG key ID: 758DD9C506603183
3 changed files with 4 additions and 4 deletions

View file

@ -11,7 +11,7 @@ public class UserMappingService {
}
public UserEntity mapToUserEntity(CreateUserDto createUserDto) {
return new UserEntity(createUserDto.getUsername(), createUserDto.getKeycloakId(), 0);
return new UserEntity(createUserDto.getKeycloakId(), createUserDto.getUsername(), 0);
}
}

View file

@ -1,7 +1,7 @@
import { inject, Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { KeycloakProfile } from 'keycloak-js';
import { Observable } from 'rxjs';
import { catchError, EMPTY, Observable } from 'rxjs';
import { User } from '../model/User';
@Injectable({
@ -11,7 +11,7 @@ export class UserService {
private http: HttpClient = inject(HttpClient);
public getUser(id: string): Observable<User | null> {
return this.http.get<User | null>(`/backend/user/${id}`);
return this.http.get<User | null>(`/backend/user/${id}`).pipe(catchError(() => EMPTY));
}
public createUser(id: string, username: string): Observable<User> {

View file

@ -18,7 +18,7 @@ export class NavbarComponent {
login() {
try {
const baseUrl = window.location.origin;
this.keycloakService.login({ redirectUri: `${baseUrl}/home` });
this.keycloakService.login({ redirectUri: `${baseUrl}/login/success` });
} catch (error) {
console.error('Login failed:', error);
}