tesses-backup/TessesDedupWeb/Pages/Backups.razor

49 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

2024-07-23 03:49:40 +00:00
@page "/backups"
@inject DedupClient Client;
@inject Blazored.LocalStorage.ILocalStorageService localStorage;
@if(Ready)
{
var i = 0;
<article>
@foreach(var item in Items)
{
@if(i > 0)
{
<div class="divider"></div>
}
<a class="row padding" href="/backups/@item.Id?path=/">
<div class="max">
<h6 class="small">@item.DeviceName</h6>
<div>@item.Tag</div>
</div>
<label>@item.CreationDate.Humanize()</label>
</a>
i++;
}
</article>
}
@code {
public bool Ready {get;set;}=false;
public List<Backup> Items {get;set;}=new List<Backup>();
protected override async Task OnInitializedAsync()
{
var loggedIn = await localStorage.ContainKeyAsync("token");
if(loggedIn)
{
var token=await localStorage.GetItemAsStringAsync("token");
await foreach(var item in Client.GetBackupsAsync(token ?? ""))
{
Items.Add(item);
}
Ready=true;
}
}
}