mirror of
https://github.com/YuzuZensai/Termix.git
synced 2026-11-12 17:06:51 +00:00
28 lines
772 B
TypeScript
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");
|
||
|
|
}
|
||
|
|
}
|