Authority adding
This commit is contained in:
		| @@ -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) | ||||
|         { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user