Skip to content

Self-hosted, plugin-based server management.

772 B
Raw Blame
import { authApi, handleApiError } from "@/main-axios";

/**
 * Admin allowlists of private addresses that outbound requests may reach, one
 * per core feature that makes them.
 */

export async function getNotificationPrivateEndpoints(): Promise<string[]> {
  try {
    return (await authApi.get("/users/notification-private-endpoints")).data
      .hosts;
  } catch (error) {
    throw handleApiError(error, "get notification endpoint allowlist");
  }
}

export async function setNotificationPrivateEndpoints(
  hosts: string[],
): Promise<string[]> {
  try {
    return (
      await authApi.patch("/users/notification-private-endpoints", { hosts })
    ).data.hosts;
  } catch (error) {
    throw handleApiError(error, "update notification endpoint allowlist");
  }
}