private async Task EnableDataProtectionAsync() { try { await ButtonSpinner.SpinAsync(async() => { var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); await DataProtectionService.EnableProtectionAsync(NewPassword.Password); await Refresh.InvokeAsync(this); await ToastService.ShowToastAsync("Data protection enabled.", ToastType.Success); await SynchronizationService.UpdateDataProtection(ExceptPageId); Logger.LogInformation($"Data protection enabled by {authState.User.Identity.Name}"); }); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); } finally { await ModalDialogService.CloseAsync(); } }