//protected string GetUrl(string url) => Path.Combine(_baseUrl, url); protected async Task <T> WrapRequest <T>(Func <Task <BaseResponse <T> > > func) { try { var response = await func(); response.CheckSuccess(); return(response.Result); } catch (ApiException) { throw; } catch (Exception ex) { JsFunctions.Alert("Request error " + ex.Message); throw; } }
protected override async Task OnInitializedAsync() { // recupero li post dallo store, così mi evito di chiamare l'API // Post = Store.Posts.FirstOrDefault(p => p.Id == Id); var comments = await ApiProxyService.GetPostCommentsAsync(Id); var temp = new List <CommentViewModel>(); foreach (var comment in comments) { temp.Add(new CommentViewModel(comment, await JsFunctions.GetGravatarUrl(comment.Email))); } Comments = temp; Loading = false; }
/// <summary> /// Add javascript function to the same jQuery document ready where chart is initialized. /// The functions are added after the chart. /// </summary> /// <param name="name">The name of the function.</param> /// <param name="body">The body of the function.</param> /// <param name="variables">The variables of the function.</param> /// <returns></returns> public Highcharts AddJavascripFunction(string name, string body, params string[] variables) { JsFunctions.Add("function {0}({1}){{".FormatWith(name, string.Join(", ", variables)), body); return(this); }