check chats length before run kv.pipeline() otherwise get empty pipeline
This commit is contained in:
parent
7aacacb9bc
commit
805639dba4
1 changed files with 3 additions and 1 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue