update Daily API in worker, add debug
This commit is contained in:
parent
e0684a5520
commit
5a876ab13c
|
|
@ -37,6 +37,7 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const apiKey = import.meta.env["VITE_DAILY_API_KEY"]
|
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")
|
if (!apiKey) throw new Error("Daily API key is missing")
|
||||||
|
|
||||||
const response = await fetch("https://api.daily.co/v1/rooms", {
|
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 status:", response.status)
|
||||||
console.log("Response data:", await response.clone().json())
|
//console.log("Response data:", await response.clone().json())
|
||||||
|
|
||||||
if (!response.ok)
|
if (!response.ok)
|
||||||
throw new Error(`Failed to create room (${response.status})`)
|
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")
|
if (!url) throw new Error("Room URL is missing")
|
||||||
|
|
||||||
console.log("Room created successfully:", url)
|
// console.log("Room created successfully:", url)
|
||||||
console.log("Updating shape with new URL")
|
// console.log("Updating shape with new URL")
|
||||||
|
|
||||||
await this.editor.updateShape<IVideoChatShape>({
|
await this.editor.updateShape<IVideoChatShape>({
|
||||||
id: shape.id,
|
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) {
|
} catch (error) {
|
||||||
console.error("Error in ensureRoomExists:", error)
|
//console.error("Error in ensureRoomExists:", error)
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue