fix: resolve all TypeScript errors in web app
This commit is contained in:
@@ -57,15 +57,25 @@ export function WebSocketProvider({
|
||||
onProjectUpdated,
|
||||
children,
|
||||
}: WebSocketProviderProps): React.JSX.Element {
|
||||
const { isConnected, socket } = useWebSocket(workspaceId, token, {
|
||||
onTaskCreated: onTaskCreated ?? undefined,
|
||||
onTaskUpdated: onTaskUpdated ?? undefined,
|
||||
onTaskDeleted: onTaskDeleted ?? undefined,
|
||||
onEventCreated: onEventCreated ?? undefined,
|
||||
onEventUpdated: onEventUpdated ?? undefined,
|
||||
onEventDeleted: onEventDeleted ?? undefined,
|
||||
onProjectUpdated: onProjectUpdated ?? undefined,
|
||||
});
|
||||
const callbacks: {
|
||||
onTaskCreated?: (task: Task) => void;
|
||||
onTaskUpdated?: (task: Task) => void;
|
||||
onTaskDeleted?: (payload: DeletePayload) => void;
|
||||
onEventCreated?: (event: Event) => void;
|
||||
onEventUpdated?: (event: Event) => void;
|
||||
onEventDeleted?: (payload: DeletePayload) => void;
|
||||
onProjectUpdated?: (project: Project) => void;
|
||||
} = {};
|
||||
|
||||
if (onTaskCreated) callbacks.onTaskCreated = onTaskCreated;
|
||||
if (onTaskUpdated) callbacks.onTaskUpdated = onTaskUpdated;
|
||||
if (onTaskDeleted) callbacks.onTaskDeleted = onTaskDeleted;
|
||||
if (onEventCreated) callbacks.onEventCreated = onEventCreated;
|
||||
if (onEventUpdated) callbacks.onEventUpdated = onEventUpdated;
|
||||
if (onEventDeleted) callbacks.onEventDeleted = onEventDeleted;
|
||||
if (onProjectUpdated) callbacks.onProjectUpdated = onProjectUpdated;
|
||||
|
||||
const { isConnected, socket } = useWebSocket(workspaceId, token, callbacks);
|
||||
|
||||
const value: WebSocketContextValue = {
|
||||
isConnected,
|
||||
|
||||
Reference in New Issue
Block a user