cleaned code
This commit is contained in:
@@ -25,7 +25,7 @@ public class WhiteboardHub : Hub
|
||||
public async Task JoinWhiteboard(Guid whiteboardId)
|
||||
{
|
||||
if (!_whiteboardManager.WhiteboardExists(whiteboardId))
|
||||
await _whiteboardManager.AddWhiteboard(whiteboardId);
|
||||
await _whiteboardManager.LoadWhiteboard(whiteboardId);
|
||||
|
||||
await Groups.AddToGroupAsync(Context.ConnectionId, whiteboardId.ToString());
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class WhiteboardManager
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task AddWhiteboard(Guid whiteboardId)
|
||||
public async Task LoadWhiteboard(Guid whiteboardId)
|
||||
{
|
||||
var getWhiteboardService = _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<GetWhiteboardService>();
|
||||
var whiteboard = await getWhiteboardService.GetWhiteboard(whiteboardId);
|
||||
@@ -36,12 +36,12 @@ public class WhiteboardManager
|
||||
{
|
||||
var whiteboard = GetWhiteboard(whiteboardId);
|
||||
|
||||
if (whiteboard == null)
|
||||
if (whiteboard is not null)
|
||||
{
|
||||
RemoveWhiteboard(whiteboardId);
|
||||
}
|
||||
|
||||
await AddWhiteboard(whiteboardId);
|
||||
await LoadWhiteboard(whiteboardId);
|
||||
}
|
||||
|
||||
public Whiteboard? GetWhiteboard(Guid whiteboardId)
|
||||
|
||||
Reference in New Issue
Block a user