mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-14 17:01:18 +08:00
7b31935f74
* feat: add icon list for demo page of icon * feat: add copy function for icon list * feat: get existed icon * feat: remove some blanks in list.razor * feat: remove some blanks * fix: default value is outline for icon list * fix: click to copy for icon list * feat: add async to load icon list * feat: update iconlistService * chore: update icons * fix: icon load async * feat: add application icons in IconlistServices * fix: remove the exist icon from existed catogory if duplicated * fix: add @key for list items * fix: revert the change Co-authored-by: ElderJames <shunjiey@hotmail.com>
28 lines
808 B
C#
28 lines
808 B
C#
using System;
|
|
using System.Net.Http;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AntDesign.core.Extensions
|
|
{
|
|
public static class HttpClientExtensions
|
|
{
|
|
public static async Task<TValue> GetFromJsonAsync<TValue>(this HttpClient client, string requestUri, CancellationToken cancellationToken = default)
|
|
{
|
|
if (client == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(client));
|
|
}
|
|
|
|
var res = await client.GetAsync(requestUri);
|
|
if (res.IsSuccessStatusCode)
|
|
{
|
|
var json = await res.Content.ReadAsStreamAsync();
|
|
return await System.Text.Json.JsonSerializer.DeserializeAsync<TValue>(json);
|
|
}
|
|
|
|
return default;
|
|
}
|
|
}
|
|
}
|