fix: remove API call from switchLanguage to avoid destructive PUT

pull/97/head
Juan Manuel Bardallo 2026-07-08 14:19:07 +02:00
parent ee05f6a2cd
commit 6beeee4f0e
1 changed files with 1 additions and 14 deletions

View File

@ -6,7 +6,6 @@ import { BreakpointObserver } from '@angular/cdk/layout';
import { AuthService } from '@services/auth.service';
import { TranslateService } from '@ngx-translate/core';
import { ConfigService } from '@services/config.service';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-header',
@ -29,8 +28,7 @@ export class HeaderComponent implements OnInit {
constructor(
public dialog: MatDialog,
public auth: AuthService,
private breakpointObserver: BreakpointObserver,
private http: HttpClient
private breakpointObserver: BreakpointObserver
) { }
ngOnInit(): void {
@ -75,17 +73,6 @@ export class HeaderComponent implements OnInit {
switchLanguage(lang: string) {
this.translate.use(lang);
localStorage.setItem('language', lang);
// Persistir en servidor si el usuario está autenticado
const uuid = this.auth.uuid;
if (uuid) {
this.http.put(
`${this.config.apiUrl}/users/${uuid}`,
{ language: lang }
).subscribe({
error: (err) => console.error('Error saving language preference:', err)
});
}
}
getCurrentLanguage(): string {