Skip to content
Snippets Groups Projects
Verified Commit 6617a5ce authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #10383 TIME 1 add lang in client cache

parent b434ccae
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,14 @@ import { TranslateService } from '@ngx-translate/core'; ...@@ -16,7 +16,14 @@ import { TranslateService } from '@ngx-translate/core';
export class AppComponent { export class AppComponent {
constructor(private translate: TranslateService, public http: HttpClient, public signaturesService: SignaturesContentService, public sanitizer: DomSanitizer, private cookieService: CookieService, public notificationService: NotificationService) { constructor(private translate: TranslateService, public http: HttpClient, public signaturesService: SignaturesContentService, public sanitizer: DomSanitizer, private cookieService: CookieService, public notificationService: NotificationService) {
translate.setDefaultLang('fr');
if (this.cookieService.check('maarchParapheurLang')) {
const cookieInfoLang = this.cookieService.get('maarchParapheurLang');
translate.setDefaultLang(cookieInfoLang);
} else {
this.cookieService.set( 'maarchParapheurLang', 'fr' );
translate.setDefaultLang('fr');
}
if (this.cookieService.check('maarchParapheurAuth')) { if (this.cookieService.check('maarchParapheurAuth')) {
const cookieInfo = JSON.parse(atob(this.cookieService.get('maarchParapheurAuth'))); const cookieInfo = JSON.parse(atob(this.cookieService.get('maarchParapheurAuth')));
......
...@@ -10,7 +10,6 @@ import { NotificationService } from '../service/notification.service'; ...@@ -10,7 +10,6 @@ import { NotificationService } from '../service/notification.service';
import { environment } from '../../core/environments/environment'; import { environment } from '../../core/environments/environment';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { Validators, FormControl } from '@angular/forms'; import { Validators, FormControl } from '@angular/forms';
import { last } from '@angular/router/src/utils/collection';
@Component({ @Component({
templateUrl: 'login.component.html', templateUrl: 'login.component.html',
...@@ -81,6 +80,7 @@ export class LoginComponent implements OnInit, AfterViewInit { ...@@ -81,6 +80,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
this.signaturesService.userLogged = data.user; this.signaturesService.userLogged = data.user;
this.translate.use(this.signaturesService.userLogged.preferences.lang); this.translate.use(this.signaturesService.userLogged.preferences.lang);
this.cookieService.set( 'maarchParapheurLang', this.signaturesService.userLogged.preferences.lang );
this.loadingForm = true; this.loadingForm = true;
$('.maarchLogo').css({ 'transform': 'translateY(0px)' }); $('.maarchLogo').css({ 'transform': 'translateY(0px)' });
......
...@@ -209,6 +209,7 @@ export class ProfileComponent implements OnInit { ...@@ -209,6 +209,7 @@ export class ProfileComponent implements OnInit {
this.signaturesService.userLogged.preferences = data.user.preferences; this.signaturesService.userLogged.preferences = data.user.preferences;
this.profileInfo.picture = data.user.picture; this.profileInfo.picture = data.user.picture;
this.setLang(this.signaturesService.userLogged.preferences.lang); this.setLang(this.signaturesService.userLogged.preferences.lang);
this.cookieService.set( 'maarchParapheurLang', this.signaturesService.userLogged.preferences.lang );
$('.avatarProfile').css({ 'transform': 'rotate(0deg)' }); $('.avatarProfile').css({ 'transform': 'rotate(0deg)' });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment