mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
Refactor useWebSocket hook to use ReturnType for timeout and interval references; add TicketNotification types for handling ticket notifications.
This commit is contained in:
@@ -19,8 +19,8 @@ interface UseWebSocketOptions {
|
||||
export function useWebSocket(options: UseWebSocketOptions = {}) {
|
||||
const { accessToken, isAuthenticated } = useAuthStore()
|
||||
const wsRef = useRef<WebSocket | null>(null)
|
||||
const reconnectTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
||||
const pingIntervalRef = useRef<NodeJS.Timeout | null>(null)
|
||||
const reconnectTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
const pingIntervalRef = useRef<ReturnType<typeof setInterval> | null>(null)
|
||||
const [isConnected, setIsConnected] = useState(false)
|
||||
const reconnectAttemptsRef = useRef(0)
|
||||
const maxReconnectAttempts = 5
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user