update Daily API in worker, add debug

This commit is contained in:
Jeff Emmett 2024-12-16 17:00:15 -05:00
parent e0684a5520
commit 5a876ab13c
1 changed files with 7 additions and 6 deletions

View File

@ -37,6 +37,7 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
try {
const apiKey = import.meta.env["VITE_DAILY_API_KEY"]
console.log("API Key available:", !!apiKey)
if (!apiKey) throw new Error("Daily API key is missing")
const response = await fetch("https://api.daily.co/v1/rooms", {
@ -54,8 +55,8 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
}),
})
console.log("Response status:", response.status)
console.log("Response data:", await response.clone().json())
//console.log("Response status:", response.status)
//console.log("Response data:", await response.clone().json())
if (!response.ok)
throw new Error(`Failed to create room (${response.status})`)
@ -65,8 +66,8 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
if (!url) throw new Error("Room URL is missing")
console.log("Room created successfully:", url)
console.log("Updating shape with new URL")
// console.log("Room created successfully:", url)
// console.log("Updating shape with new URL")
await this.editor.updateShape<IVideoChatShape>({
id: shape.id,
@ -77,9 +78,9 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
},
})
console.log("Shape updated:", this.editor.getShape(shape.id))
//console.log("Shape updated:", this.editor.getShape(shape.id))
} catch (error) {
console.error("Error in ensureRoomExists:", error)
//console.error("Error in ensureRoomExists:", error)
throw error
}
}