sql schema update + start share logic

This commit is contained in:
Ishaan Dey
2024-05-01 01:29:16 -04:00
parent c171cb580e
commit 66a76eb0f9
13 changed files with 294 additions and 82 deletions

View File

@ -30,10 +30,12 @@ import {
SelectValue,
} from "@/components/ui/select"
import { Loader2, UserPlus, X } from "lucide-react"
import { useState } from "react"
import { useState, useTransition } from "react"
import { Sandbox } from "@/lib/types"
import { Button } from "@/components/ui/button"
import Avatar from "@/components/ui/avatar"
import { shareSandbox } from "@/lib/actions"
import { toast } from "sonner"
const formSchema = z.object({
email: z.string().email(),
@ -64,6 +66,14 @@ export default function ShareSandboxModal({
// const id = await createSandbox(sandboxData)
console.log(values)
setLoading(true)
const res = await shareSandbox(data.id, values.email)
if (!res) {
toast.error("Failed to share.")
}
setLoading(false)
}
return (