@@ -5,7 +5,7 @@ import { Input } from '@/components/ui/input';
55import { Card , CardHeader , CardTitle , CardContent } from '@/components/ui/card' ;
66import { Badge } from '@/components/ui/badge' ;
77import { X } from 'lucide-react' ;
8- import { useConnectionsStream , ConnectionInfo , fetcher } from '@/api/v1' ;
8+ import { useConnectionsStream , ConnectionInfo , useDeleteConn , useDeleteConnections } from '@/api/v1' ;
99import { useInstance } from '@/contexts/instance' ;
1010
1111// Connection type for UI display
@@ -151,6 +151,8 @@ export const ConnectionsManager = () => {
151151 const [ searchQuery , setSearchQuery ] = useState ( '' ) ;
152152 const [ sortOption , setSortOption ] = useState < SortOption > ( 'time' ) ;
153153 const [ sortDirection , setSortDirection ] = useState < SortDirection > ( 'asc' ) ;
154+ const { trigger : triggerDeleteAll } = useDeleteConnections ( currentInstance ?. url ) ;
155+ const { trigger : triggerDeleteConn } = useDeleteConn ( currentInstance ?. url ) ;
154156
155157 const { formattedConnections, sortedConnections } = useMemo ( ( ) => {
156158 if ( ! state ) {
@@ -210,7 +212,7 @@ export const ConnectionsManager = () => {
210212 if ( ! currentInstance ?. url ) return ;
211213
212214 try {
213- await fetcher ( [ '/conn/:uuid' , 'delete' , undefined , { uuid : id } , currentInstance . url ] ) ;
215+ await triggerDeleteConn ( id ) ;
214216 // The WebSocket connection will update the state automatically
215217 } catch ( error ) {
216218 console . error ( 'Failed to close connection:' , error ) ;
@@ -222,7 +224,7 @@ export const ConnectionsManager = () => {
222224 if ( ! currentInstance ?. url ) return ;
223225
224226 try {
225- await fetcher ( [ '/connections' , 'delete' , undefined , currentInstance . url ] ) ;
227+ await triggerDeleteAll ( ) ;
226228 // The WebSocket connection will update the state automatically
227229 } catch ( error ) {
228230 console . error ( 'Failed to close all connections:' , error ) ;
0 commit comments