From 6da090d79f521faf3f7b722e5a6e23af4ed12ead Mon Sep 17 00:00:00 2001 From: PEDZEO Date: Mon, 19 Jan 2026 00:08:38 +0300 Subject: [PATCH] Refactor useWebSocket hook to use ReturnType for timeout and interval references; add TicketNotification types for handling ticket notifications. --- src/hooks/useWebSocket.ts | 4 ++-- src/types/index.ts | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/hooks/useWebSocket.ts b/src/hooks/useWebSocket.ts index 1630a63..88c9887 100644 --- a/src/hooks/useWebSocket.ts +++ b/src/hooks/useWebSocket.ts @@ -19,8 +19,8 @@ interface UseWebSocketOptions { export function useWebSocket(options: UseWebSocketOptions = {}) { const { accessToken, isAuthenticated } = useAuthStore() const wsRef = useRef(null) - const reconnectTimeoutRef = useRef(null) - const pingIntervalRef = useRef(null) + const reconnectTimeoutRef = useRef | null>(null) + const pingIntervalRef = useRef | null>(null) const [isConnected, setIsConnected] = useState(false) const reconnectAttemptsRef = useRef(0) const maxReconnectAttempts = 5 diff --git a/src/types/index.ts b/src/types/index.ts index 64cb61f..d040af7 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -516,3 +516,22 @@ export interface ManualCheckResponse { old_status: string | null new_status: string | null } + +// Ticket notification types +export interface TicketNotification { + id: number + ticket_id: number + notification_type: string + message: string + is_read: boolean + created_at: string +} + +export interface TicketNotificationList { + items: TicketNotification[] + total: number +} + +export interface UnreadCountResponse { + unread_count: number +}