mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-24 03:55:06 +03:00
17 lines
494 B
TypeScript
17 lines
494 B
TypeScript
import { API_BASE_URL } from "@/core/config";
|
|
import { getAuthHeaders } from "./user/auth";
|
|
import type { IceServersResponse } from "@/core/types";
|
|
|
|
/**
|
|
* Fetches ICE server configuration for WebRTC
|
|
*/
|
|
export async function iceServers(token: string): Promise<IceServersResponse> {
|
|
const res = await fetch(`${API_BASE_URL}/webrtc/ice`, {
|
|
headers: getAuthHeaders(token, true)
|
|
});
|
|
if (!res.ok) throw new Error("Failed to fetch ICE servers");
|
|
return await res.json();
|
|
}
|
|
|
|
|