From f1c0b5435b65c4c19b22a976b9cc686100458e07 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Wed, 30 Oct 2024 09:11:48 +0530 Subject: [PATCH] feat(delete-chat): use `window.location` to refresh page --- ui/components/DeleteChat.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ui/components/DeleteChat.tsx b/ui/components/DeleteChat.tsx index 984db70..2857fc8 100644 --- a/ui/components/DeleteChat.tsx +++ b/ui/components/DeleteChat.tsx @@ -11,7 +11,6 @@ import { import { Fragment, useState } from 'react'; import { toast } from 'sonner'; import { Chat } from '@/app/library/page'; -import { useRouter } from 'next/navigation'; const DeleteChat = ({ chatId, @@ -27,8 +26,6 @@ const DeleteChat = ({ const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false); const [loading, setLoading] = useState(false); - const router = useRouter(); - const handleDelete = async () => { setLoading(true); try { @@ -51,7 +48,7 @@ const DeleteChat = ({ setChats(newChats); if (redirect) { - router.push('/'); + window.location.href = '/'; } } catch (err: any) { toast.error(err.message);