unsharing logic

This commit is contained in:
Ishaan Dey
2024-05-01 02:22:02 -04:00
parent 5ba1c03030
commit e23b38875e
4 changed files with 118 additions and 55 deletions

View File

@ -60,3 +60,15 @@ export async function shareSandbox(sandboxId: string, email: string) {
revalidatePath(`/code/${sandboxId}`)
return { success: true, message: "Shared successfully." }
}
export async function unshareSandbox(sandboxId: string, userId: string) {
const res = await fetch("http://localhost:8787/api/sandbox/share", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ sandboxId, userId }),
})
revalidatePath(`/code/${sandboxId}`)
}