fix: загрузка Telegram Login Widget через JS interop для корректной работы с Blazor SPA-навигацией
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@inject NavigationManager Navigation
|
||||
@inject IConfiguration Configuration
|
||||
@inject IJSRuntime JS
|
||||
|
||||
<PageTitle>Вход — GM-Relay</PageTitle>
|
||||
|
||||
@@ -18,13 +19,7 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<div id="telegram-login-container">
|
||||
<script async src="https://telegram.org/js/telegram-widget.js?22"
|
||||
data-telegram-login="@BotUsername"
|
||||
data-size="large"
|
||||
data-auth-url="@AuthUrl"
|
||||
data-request-access="write"></script>
|
||||
</div>
|
||||
<div id="telegram-login-container"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -46,4 +41,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await JS.InvokeVoidAsync("loadTelegramWidget", BotUsername, AuthUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user