mirror of
https://github.com/dpup/meshstream.git
synced 2026-08-11 19:22:52 +02:00
Fix double loading of data
This commit is contained in:
@@ -16,22 +16,6 @@ export interface ApiResponse<T> {
|
||||
error?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a list of the most recent packets from the server
|
||||
*/
|
||||
export async function fetchRecentPackets(): Promise<ApiResponse<Packet[]>> {
|
||||
try {
|
||||
const response = await fetch(API_ENDPOINTS.RECENT_PACKETS);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
return { data };
|
||||
} catch (error) {
|
||||
return { error: error instanceof Error ? error.message : String(error) };
|
||||
}
|
||||
}
|
||||
|
||||
// Re-export types
|
||||
export type {
|
||||
InfoEvent,
|
||||
|
||||
@@ -26,5 +26,4 @@ export const API_BASE_URL = getApiBaseUrl();
|
||||
// API endpoints
|
||||
export const API_ENDPOINTS = {
|
||||
STREAM: `${API_BASE_URL}/api/stream`,
|
||||
RECENT_PACKETS: `${API_BASE_URL}/api/packets/recent`,
|
||||
};
|
||||
Reference in New Issue
Block a user