diff --git a/source/Plugins/AyaNova.Plugin.V8/util.cs b/source/Plugins/AyaNova.Plugin.V8/util.cs index acbb33a..7a2a6de 100644 --- a/source/Plugins/AyaNova.Plugin.V8/util.cs +++ b/source/Plugins/AyaNova.Plugin.V8/util.cs @@ -29,6 +29,8 @@ namespace AyaNova.PlugIn.V8 JWT = string.Empty; } + + #region INIT / AUTH private static void InitClient() { if (Initialized) return; @@ -90,28 +92,28 @@ namespace AyaNova.PlugIn.V8 - + public async static Task AuthenticateAsync(string login, string password = null) { InitClient(); if (password == null) password = login; - - dynamic creds = new JObject(); - creds.login = login; - creds.password = password; - ApiResponse a = await PostAsync("Auth", creds.ToString()); + dynamic creds = new JObject(); + creds.login = login; + creds.password = password; - if (a.HttpResponse.IsSuccessStatusCode) - { - JWT=a.ObjectResponse["data"]["token"].Value(); - return true; - } + ApiResponse a = await PostAsync("Auth", creds.ToString()); + + if (a.HttpResponse.IsSuccessStatusCode) + { + JWT = a.ObjectResponse["data"]["token"].Value(); + return true; + } - return false; + return false; } @@ -179,6 +181,7 @@ namespace AyaNova.PlugIn.V8 } return JObject.Parse(jsonString); } + #endregion }//eoc