using CMSMicroservice.Protobuf.Protos.Role;
using Microsoft.AspNetCore.Components;

namespace BackOffice.Pages.UserRole.Components;
public partial class RoleTitleColumn
{
    [Parameter]
    public long RoleId { get; set; }

    [Inject] public RoleContract.RoleContractClient RoleService { get; set; }

    private GetRoleResponse getRoleResponse = new();
    private bool _isLoading = true;

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        await base.OnAfterRenderAsync(firstRender);
        if (firstRender)
        {
            
                getRoleResponse = await RoleService.GetRoleAsync(new()
                {
                    Id = RoleId
                });
            
            _isLoading = false;
            StateHasChanged();
        }
    }
}