/
aprogrammer
/
blazor-workshop
Обзор
Документация
Войти
/
aprogrammer
/
blazor-workshop
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/BlazingPizza.Client/Pages/Authentication.razor
32 строки
991 B
Ed Charbeneau
Nullable (#365)
29 ноя 2023, 23:47
Не верифицирован
29 ноя 2023, 23:47
bb345a1
Код
Авторство
О чём код?
@page "/authentication/{action}" @inject OrderState OrderState @inject NavigationManager NavigationManager <RemoteAuthenticatorViewCore TAuthenticationState="PizzaAuthenticationState" AuthenticationState="RemoteAuthenticationState" OnLogInSucceeded="RestorePizza" Action="@Action" /> @code{ [Parameter] public string Action { get; set; } = string.Empty; public PizzaAuthenticationState RemoteAuthenticationState { get; set; } = new PizzaAuthenticationState(); protected override void OnInitialized() { if (RemoteAuthenticationActions.IsAction(RemoteAuthenticationActions.LogIn, Action)) { // Preserve the current order so that we don't loose it RemoteAuthenticationState.Order = OrderState.Order; } } private void RestorePizza(PizzaAuthenticationState pizzaState) { if (pizzaState.Order is not null) { OrderState.ReplaceOrder(pizzaState.Order); } } }