Files
Termix/src/ui/api/private-endpoints-api.ts
T

28 lines
772 B
TypeScript

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");
}
}