Run prettier

This commit is contained in:
Jared Palmer 2023-06-02 15:33:48 -04:00
parent aa83a871dd
commit 417f69e0f1
34 changed files with 530 additions and 523 deletions

View file

@ -1,27 +1,27 @@
"use server";
'use server'
import { kv } from "@vercel/kv";
import { revalidatePath } from "next/cache";
import { kv } from '@vercel/kv'
import { revalidatePath } from 'next/cache'
export async function removeChat({
id,
path,
userId,
userId
}: {
id: string;
userId: string;
path: string;
id: string
userId: string
path: string
}) {
// @todo next-auth@v5 doesn't work in server actions yet
// const session = await auth();
const uid = await kv.hget<string>(`chat:${id}`, "userId");
const uid = await kv.hget<string>(`chat:${id}`, 'userId')
if (uid !== userId) {
throw new Error("Unauthorized");
throw new Error('Unauthorized')
}
await kv.del(`chat:${id}`);
await kv.zrem(`user:chat:${userId}`, `chat:${id}`);
await kv.del(`chat:${id}`)
await kv.zrem(`user:chat:${userId}`, `chat:${id}`)
revalidatePath("/");
revalidatePath("/chat/[id]");
revalidatePath('/')
revalidatePath('/chat/[id]')
}