check chats length before run kv.pipeline() otherwise get empty pipeline

This commit is contained in:
UrNas 2023-06-21 02:01:22 +03:00
parent 7aacacb9bc
commit 805639dba4

View file

@ -74,7 +74,9 @@ export async function clearChats() {
}
const chats: string[] = await kv.zrange(`user:chat:${session.user.id}`, 0, -1)
if (!chats.length) {
return redirect('/')
}
const pipeline = kv.pipeline()
for (const chat of chats) {