Delete profile should refresh profiles list

This commit is contained in:
hishamco
2021-03-13 13:02:40 +03:00
parent 51687c382d
commit c5e3c9b35e

View File

@ -32,7 +32,7 @@ else
protected override async Task OnInitializedAsync()
{
_profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
await GetProfilesAsync();
}
private async Task DeleteProfile(int profileId)
@ -41,7 +41,12 @@ else
{
await ProfileService.DeleteProfileAsync(profileId);
await logger.LogInformation("Profile Deleted {ProfileId}", profileId);
AddModuleMessage(Localizer["Profile Deleted"], MessageType.Success);
await GetProfilesAsync();
StateHasChanged();
}
catch (Exception ex)
{
@ -49,4 +54,7 @@ else
AddModuleMessage(Localizer["Error Deleting Profile"], MessageType.Error);
}
}
private async Task GetProfilesAsync()
=> _profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
}