first commit -push
This commit is contained in:
24
RobotNet.ScriptManager/Hubs/DashboardHub.cs
Normal file
24
RobotNet.ScriptManager/Hubs/DashboardHub.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using RobotNet.Script.Shares.Dashboard;
|
||||
using RobotNet.ScriptManager.Services;
|
||||
using RobotNet.Shares;
|
||||
|
||||
namespace RobotNet.ScriptManager.Hubs;
|
||||
|
||||
[Authorize]
|
||||
public class DashboardHub(DashboardPublisher DashboardPublisher, ILogger<DashboardHub> Logger) : Hub
|
||||
{
|
||||
public MessageResult<DashboardDto> GetDashboardData()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new(true, "") { Data = DashboardPublisher.GetData() };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogWarning("Lấy dữ liệu Dashboard xảy ra lỗi: {ex}", ex.Message);
|
||||
return new(false, "Lấy dữ liệu Dashboard xảy ra lỗi");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user