using Microsoft.AspNetCore.Mvc;

namespace Admin.Pages.Shared.Layout
{
    public class LayoutViewComponent : ViewComponent
    {
        private readonly ILayoutDataProvider _provider;

        public LayoutViewComponent(ILayoutDataProvider provider)
        {
            _provider = provider;
        }

        public async Task<IViewComponentResult> InvokeAsync()
        {
            return View(
                await _provider.CreateAsync(HttpContext)
            );
        }
    }
}