Remove auth on delete for now
This commit is contained in:
parent
a7af3107b5
commit
01527d450b
4 changed files with 27 additions and 9 deletions
|
|
@ -5,13 +5,22 @@ import { chats, db } from "@/lib/db/schema";
|
|||
import { and, eq } from "drizzle-orm";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function removeChat({ id, path }: { id: string; path: string }) {
|
||||
const session = await auth();
|
||||
export async function removeChat({
|
||||
id,
|
||||
path,
|
||||
userId,
|
||||
}: {
|
||||
id: string;
|
||||
userId: string;
|
||||
path: string;
|
||||
}) {
|
||||
// @todo next-auth doesn't work in server actions yet
|
||||
// const session = await auth();
|
||||
|
||||
const userId = session?.user?.email;
|
||||
if (!userId || !id) {
|
||||
throw new Error("Unauthorized");
|
||||
}
|
||||
// const userId = session?.user?.email;
|
||||
// if (!userId || !id) {
|
||||
// throw new Error("Unauthorized");
|
||||
// }
|
||||
|
||||
await db
|
||||
.delete(chats)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue