Merge pull request 'adding a basic page to dump sources' (#2) from features/list-sources into main
Reviewed-on: #2
This commit is contained in:
commit
f77481152f
@ -4,5 +4,4 @@ public static class Global
|
|||||||
{
|
{
|
||||||
public static HttpClient HttpClient { get; set; }
|
public static HttpClient HttpClient { get; set; }
|
||||||
public static string? DefaultInstanceUri { get; set; }
|
public static string? DefaultInstanceUri { get; set; }
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,37 @@
|
|||||||
@page "/sources/list"
|
@page "/sources/list"
|
||||||
<h3>list</h3>
|
@using Newsbot.Collector.Client
|
||||||
|
@using Newsbot.Collector.Client.Domain.Dto
|
||||||
|
|
||||||
|
<h3>Available Sources</h3>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>Title</td>
|
||||||
|
<td>Publish Date</td>
|
||||||
|
</tr>
|
||||||
|
@foreach (var item in Data ??= new List<SourcesDto>())
|
||||||
|
{
|
||||||
|
if (!item.Enabled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="@item.Url" target="_blank">@item.Name</a><br/>
|
||||||
|
</td>
|
||||||
|
<td>@item.Source</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</table>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
private List<SourcesDto> Data { get; set; }
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
var c = new SourcesClient(Global.HttpClient, Global.DefaultInstanceUri ?? "");
|
||||||
|
var items = await c.ListAsync();
|
||||||
|
Data = items;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user