feat(profile): add updateProfile method and enhance password validation in register form

This commit is contained in:
2026-07-08 12:06:36 -03:00
parent b016569b10
commit 7507580c2c
3 changed files with 25 additions and 2 deletions

View File

@@ -18,6 +18,14 @@ export interface RegisterPayload {
password_confirmation: string;
}
export interface UpdateProfilePayload {
nombre_apellido: string;
email: string;
dni?: string;
telefono?: string;
password?: string;
}
export interface LoginResponse {
message: string;
token: string;

View File

@@ -9,7 +9,8 @@ import {
LoginPayload,
LoginResponse,
RegisterPayload,
RegisterResponse
RegisterResponse,
UpdateProfilePayload
} from './auth.interfaces';
import { CookieService } from '../cookie/cookie.service';
@@ -43,6 +44,12 @@ export class AuthService {
return this.http.post<RegisterResponse>(`${environment.url}register`, payload);
}
updateProfile(payload: UpdateProfilePayload): Observable<AuthUser> {
return this.http.put<AuthUser>(`${environment.url}me`, payload).pipe(
tap((user) => this.userState.set(user))
);
}
logout(): Observable<void> {
if (!this.tokenState()) {
this.clearSession();