using Dapr.Client;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace MyFrontEnd.Pages
{
    public class PrivacyModel : PageModel
    {
        private readonly DaprClient _daprClient;
        private readonly ILogger<PrivacyModel> _logger;

        public PrivacyModel(
            DaprClient daprClient,
            ILogger<PrivacyModel> logger)
        {
            _daprClient = daprClient;
            _logger = logger;
        }

        public async Task OnGet()
        {
            var menus = await _daprClient.InvokeMethodAsync<IEnumerable<WeatherForecast>>(
                 HttpMethod.Get,
                 "hotline",
                 "api/v1/Sys/getmenujson");

            ViewData["menus"] = menus;
        }
    }
}