re-organize files + setup more orchestration logic

This commit is contained in:
Ishaan Dey
2024-05-12 02:10:31 -07:00
parent e699028096
commit 18aca540cc
9 changed files with 848 additions and 780 deletions

View File

@ -47,4 +47,27 @@ export function addNew(name: string, type: "file" | "folder", setFiles: React.Di
console.log("adding folder");
setFiles(prev => [...prev, { id: `projects/${sandboxData.id}/${name}`, name, type: "folder", children: [] }])
}
}
export async function startServer(sandboxId: string, userId: string, callback: (success: boolean) => void) {
try {
await fetch("http://localhost:4001/start", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
sandboxId,
userId
}),
})
callback(true)
} catch (error) {
console.error("Failed to start server", error)
callback(false)
}
}