Authority adding

This commit is contained in:
2024-09-12 22:13:53 +03:00
parent 9015348aa6
commit e087cb47a6
4 changed files with 90 additions and 4 deletions

View File

@@ -18,6 +18,8 @@
<NavLink href="@path">
<button class="btn-outline-primary">Change</button>
</NavLink>
|
<button class="btn-outline-danger" @onclick="() => Delete(authority)">Delete</button>
</td>
</tr>
}
@@ -25,13 +27,27 @@
</table>
@code {
private IEnumerable<UserModel> authorities = [];
private List<UserModel> authorities = [];
protected override async Task OnInitializedAsync()
{
try
{
authorities = await Client.GetAuthorityAccountsAsync();
authorities = (await Client.GetAuthorityAccountsAsync()).ToList();
}
catch (Exception e)
{
ErrorHandler.Handle(e);
}
}
private async Task Delete(UserModel authority)
{
try
{
await Client.RemoveAuthorityAccountAsync(authority.Id);
authorities.Remove(authority);
StateHasChanged();
}
catch (Exception e)
{