diff --git a/src/lib/api.ts b/src/lib/api.ts index bac7291..87ebd3e 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -73,6 +73,10 @@ interface UserData { name: string; } +interface ErrorMessage { + message: string; +} + // Generic function for making API requests export async function apiFetch( endpoint: string, @@ -114,7 +118,7 @@ export async function apiFetch( return await response.json() as T; } catch (error) { console.error(`API fetch error: ${error}`); - throw error; + throw error as ErrorMessage; } }