Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: zomars <zomars@me.com>
16 lines
521 B
TypeScript
16 lines
521 B
TypeScript
import { getDailyAppKeys } from "@calcom/app-store/dailyvideo/lib/getDailyAppKeys";
|
|
import { handleErrorsJson } from "@calcom/lib/errors";
|
|
|
|
export const fetcher = async (endpoint: string, init?: RequestInit | undefined) => {
|
|
const { api_key } = await getDailyAppKeys();
|
|
return fetch(`https://api.daily.co/v1${endpoint}`, {
|
|
method: "GET",
|
|
headers: {
|
|
Authorization: `Bearer ${api_key}`,
|
|
"Content-Type": "application/json",
|
|
...init?.headers,
|
|
},
|
|
...init,
|
|
}).then(handleErrorsJson);
|
|
};
|