Добавлен вывод QR яндекса
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
@attribute [Authorize]
|
||||
@inject HttpClient Http
|
||||
@inject IDialogService DialogService
|
||||
@using PlaylistShared.Pwa.Components.Profile
|
||||
@using PlaylistShared.Pwa.Components.Profile.YandexAccount
|
||||
@using PlaylistShared.Shared.Profile
|
||||
|
||||
<PageTitle>Профиль</PageTitle>
|
||||
@@ -32,11 +32,15 @@
|
||||
@_statusText
|
||||
</MudText>
|
||||
</MudStack>
|
||||
<MudButton Variant="Variant.Outlined"
|
||||
Color="Color.Primary"
|
||||
OnClick="OpenTokenDialog">
|
||||
@(_hasToken ? "Переподключить" : "Установить")
|
||||
</MudButton>
|
||||
|
||||
<MudMenu EndIcon="@Icons.Material.Filled.ArrowDropDown"
|
||||
Label="@(_hasToken ? "Переподключить" : "Подключить")"
|
||||
Variant="Variant.Outlined"
|
||||
Dense
|
||||
Color="Color.Primary">
|
||||
<MudMenuItem OnClick="OpenTokenDialog">Token</MudMenuItem>
|
||||
<MudMenuItem OnClick="OpenQrDialog">Qr</MudMenuItem>
|
||||
</MudMenu>
|
||||
</MudStack>
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
@@ -44,7 +48,7 @@
|
||||
</MudContainer>
|
||||
|
||||
@code {
|
||||
private string _email = "user@example.com"; // Загрузите из стейта или API
|
||||
private string _email = "user@example.com";
|
||||
private string _statusText = "Загрузка...";
|
||||
private bool _hasToken;
|
||||
|
||||
@@ -54,7 +58,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await Http.GetFromJsonAsync<ApiResponse<YandexTokenStatus>>("/api/yandextoken/status");
|
||||
var response = await Http.GetFromJsonAsync<ApiResponse<YandexTokenStatus>>("/api/yandexaccount/status");
|
||||
if (response?.Success == true)
|
||||
{
|
||||
_hasToken = response.Data.HasToken;
|
||||
@@ -72,4 +76,13 @@
|
||||
|
||||
if (!result.Canceled) await LoadStatus();
|
||||
}
|
||||
|
||||
private async Task OpenQrDialog()
|
||||
{
|
||||
var options = new DialogOptions { CloseOnEscapeKey = true, MaxWidth = MaxWidth.Small, FullWidth = true };
|
||||
var dialog = await DialogService.ShowAsync<YandexQrDialog>("", options);
|
||||
var result = await dialog.Result;
|
||||
|
||||
if (!result.Canceled) await LoadStatus();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user