shopping-assistant-web-client/ShoppingAssistantWebClient.Web/Pages/Index.cshtml.cs
2023-09-22 23:16:23 +03:00

24 lines
664 B
C#

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using ShoppingAssistantWebClient.Web.Network;
namespace ShoppingAssistantWebClient.Web.Pages;
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private readonly AuthenticationService _authenticationService;
public IndexModel(ILogger<IndexModel> logger, AuthenticationService authenticationService)
{
_authenticationService = authenticationService;
_logger = logger;
}
public void OnGet()
{
var token = _authenticationService.GetAuthTokenAsync().Result;
ViewData["Token"] = token;
}
}