diff --git a/frontend/src/api/apiClient.ts b/frontend/src/api/apiClient.ts index d87a512..3a53d06 100644 --- a/frontend/src/api/apiClient.ts +++ b/frontend/src/api/apiClient.ts @@ -159,6 +159,12 @@ export const fetchPackets = async (limit = 100): Promise => { return res.data; }; +export const clearPackets = async (): Promise => { + // limit default mirrors OpenAPI default + const res = await api.delete('/packets/packets'); + return res.data; +}; + /* ------------------------- Firewall ------------------------- */ diff --git a/frontend/src/components/PacketViewer.tsx b/frontend/src/components/PacketViewer.tsx index 0b272f7..356d601 100644 --- a/frontend/src/components/PacketViewer.tsx +++ b/frontend/src/components/PacketViewer.tsx @@ -1,5 +1,5 @@ // src/components/PacketViewer.tsx -import { DownloadOutlined, SyncOutlined } from '@ant-design/icons'; +import { DeleteOutlined, DownloadOutlined, SyncOutlined } from '@ant-design/icons'; import { Button, Card, @@ -17,7 +17,7 @@ import { message, } from 'antd'; import { ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { fetchPackets } from '../api/apiClient'; +import { clearPackets, fetchPackets } from '../api/apiClient'; const { Text } = Typography; const { Option } = Select; @@ -434,6 +434,7 @@ export default function PacketViewer(): ReactElement { handlePauseToggle(!checked ? true : false)} />