63825: use CookieService instead of ClientCookieService

This commit is contained in:
Kristof De Langhe
2019-07-25 11:19:59 +02:00
parent c2345c1562
commit 7269be9142
5 changed files with 19 additions and 17 deletions

View File

@@ -34,6 +34,7 @@ import { HostWindowService } from './shared/host-window.service';
import { Theme } from '../config/theme.inferface';
import { ClientCookieService } from './shared/services/client-cookie.service';
import { isNotEmpty } from './shared/empty.util';
import { CookieService } from './shared/services/cookie.service';
export const LANG_COOKIE = 'language_cookie';
@@ -65,7 +66,7 @@ export class AppComponent implements OnInit, AfterViewInit {
private cssService: CSSVariableService,
private menuService: MenuService,
private windowService: HostWindowService,
private clientCookie: ClientCookieService
private cookie: CookieService
) {
// Load all the languages that are defined as active from the config file
translate.addLangs(config.languages.filter((LangConfig) => LangConfig.active === true).map((a) => a.code));
@@ -74,7 +75,7 @@ export class AppComponent implements OnInit, AfterViewInit {
translate.setDefaultLang(config.defaultLanguage);
// Attempt to get the language from a cookie
const lang = clientCookie.get(LANG_COOKIE);
const lang = cookie.get(LANG_COOKIE);
if (isNotEmpty(lang)) {
// Cookie found
// Use the language from the cookie