public static void Authorise(this IJSRuntime jSRuntime, ref string password, ref bool isAuthorised)
 {
     if (jSRuntime.GetLocalStorageValue("kitchenPassword").Result == "BetterThanDominos")
     {
         password     = "******";
         isAuthorised = true;
     }
     if (!isAuthorised)
     {
         password = jSRuntime.Prompt("Please type the kitchen password").Result;
     }
     if (password == "BetterThanDominos")
     {
         isAuthorised = true;
     }
 }
Esempio n. 2
0
        public static async ValueTask <bool> CheckIfResponseIsOK(this HttpResponseMessage message, IJSRuntime jSRuntime, string potentialReason = "")
        {
            if (!message.IsSuccessStatusCode)
            {
                var reason = await message.Content.ReadAsStringAsync();

                await jSRuntime.Prompt(
                    DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + Environment.NewLine +
                    reason.Split("\r\n")[0] + Environment.NewLine +
                    potentialReason + string.Concat(Enumerable.Repeat(Environment.NewLine, 3)) +
                    "Developer Information:" + message.ReasonPhrase + Environment.NewLine + reason
                    ).ConfigureAwait(false);

                return(false);
            }
            return(true);
        }
 public async Task Prompt(string message)
 {
     await _jsRuntime.Prompt(message).ConfigureAwait(false);
 }