/// <summary> /// returns the cookie value or null if not set /// </summary> /// <param name="cookieName">Name of the cookie</param> /// <returns>The cookie data</returns> public async Task <string> Get(string cookieName) { var cookie = (await _jsInterop.GetCookie()) .Split(';') .Select(v => v.TrimStart().Split('=')) .FirstOrDefault(s => s[0] == cookieName); return(cookie?[1]); }
/// <summary> /// returns the cookie value or null if not set /// </summary> /// <param name="cookieName"></param> /// <returns></returns> public async Task <string> Get(Func <string, bool> filterCookie) { return((await JsInterop .GetCookie()) .Split(';') .Select(v => v.TrimStart().Split('=')) .Where(s => filterCookie(s[0])) .Select(s => s[1]) .FirstOrDefault()); }