[CHANGE] Add account dialog
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Manager.App.Components.Dialogs;
|
||||
using Manager.Data.Entities.LibraryContext;
|
||||
using Manager.YouTube;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
@@ -6,23 +8,26 @@ namespace Manager.App.Components.Pages;
|
||||
|
||||
public partial class Channels : ComponentBase
|
||||
{
|
||||
private bool _addAccountDialogVisible;
|
||||
private DialogOptions _dialogOptions = new() { BackdropClick = false, CloseButton = true, FullWidth = true };
|
||||
private List<HttpCookie> _cookies = [];
|
||||
private readonly DialogOptions _dialogOptions = new() { BackdropClick = false, CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.ExtraLarge };
|
||||
|
||||
private async Task<TableData<ChannelEntity>> ServerReload(TableState state, CancellationToken token)
|
||||
{
|
||||
var results = await LibraryService.GetChannelAccountsAsync(state.Page * state.PageSize, state.PageSize, token);
|
||||
if (!results.IsSuccess)
|
||||
{
|
||||
return new TableData<ChannelEntity>();
|
||||
}
|
||||
|
||||
return new TableData<ChannelEntity> { Items = results.Value, TotalItems = results.Total };
|
||||
return !results.IsSuccess ? new TableData<ChannelEntity>() : new TableData<ChannelEntity> { Items = results.Value, TotalItems = results.Total };
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnAddAccountDialogAsync()
|
||||
{
|
||||
var libSettings = LibraryOptions.Value;
|
||||
var parameters = new DialogParameters<AccountDialog> { { x => x.DefaultUserAgent, libSettings.DefaultUserAgent } };
|
||||
var dialog = await DialogService.ShowAsync<AccountDialog>("Add account", parameters, _dialogOptions);
|
||||
var result = await dialog.Result;
|
||||
|
||||
public record HttpCookie()
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
if (result == null || result.Canceled || result.Data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var client = (YouTubeClient)result.Data;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user