Use cookie everywhere

This commit is contained in:
hishamco
2020-12-03 17:15:08 +03:00
parent 049ded6f7e
commit 20f1a6175f
7 changed files with 9 additions and 50 deletions

View File

@ -1,6 +1,7 @@
@namespace Oqtane.Themes.Controls
@inherits ThemeControlBase
@using System.Globalization
@using System.Globalization
@using Microsoft.AspNetCore.Localization;
@using Oqtane.Models
@inject ILocalizationService LocalizationService
@inject NavigationManager NavigationManager
@ -36,7 +37,8 @@
if (culture != CultureInfo.CurrentUICulture.Name)
{
var interop = new Interop(JSRuntime);
await interop.SetLocalStorage("OqtaneCulture", culture);
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
await interop.SetCookie(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, 360);
NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true);
}