fix: 500 when loggin in
This commit is contained in:
parent
5afdbad461
commit
a091387c1c
3 changed files with 4 additions and 4 deletions
|
@ -11,7 +11,7 @@ public class UserMappingService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserEntity mapToUserEntity(CreateUserDto createUserDto) {
|
public UserEntity mapToUserEntity(CreateUserDto createUserDto) {
|
||||||
return new UserEntity(createUserDto.getUsername(), createUserDto.getKeycloakId(), 0);
|
return new UserEntity(createUserDto.getKeycloakId(), createUserDto.getUsername(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { inject, Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { KeycloakProfile } from 'keycloak-js';
|
import { KeycloakProfile } from 'keycloak-js';
|
||||||
import { Observable } from 'rxjs';
|
import { catchError, EMPTY, Observable } from 'rxjs';
|
||||||
import { User } from '../model/User';
|
import { User } from '../model/User';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
@ -11,7 +11,7 @@ export class UserService {
|
||||||
private http: HttpClient = inject(HttpClient);
|
private http: HttpClient = inject(HttpClient);
|
||||||
|
|
||||||
public getUser(id: string): Observable<User | null> {
|
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> {
|
public createUser(id: string, username: string): Observable<User> {
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class NavbarComponent {
|
||||||
login() {
|
login() {
|
||||||
try {
|
try {
|
||||||
const baseUrl = window.location.origin;
|
const baseUrl = window.location.origin;
|
||||||
this.keycloakService.login({ redirectUri: `${baseUrl}/home` });
|
this.keycloakService.login({ redirectUri: `${baseUrl}/login/success` });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Login failed:', error);
|
console.error('Login failed:', error);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue