summaryrefslogtreecommitdiff
path: root/api/alerts.ts
blob: 8fbcb07d00db997ac54d796789c145adaa846c4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { apiClient } from "./client";
import { Alert } from "./types";

export async function getAlerts(): Promise<Alert[]> {
  try {
    console.log("getAlerts: Making API call to /parent/alerts");
    const response = await apiClient.get<{
      success: boolean;
      alerts: Alert[];
    }>("/parent/alerts");

    console.log("getAlerts: API response:", response);
    return response.alerts;
  } catch (e) {
    console.error("Failed to fetch alerts", e);
    return [];
  }
}