loading ,page

This commit is contained in:
Arezoo
2025-10-27 10:58:26 +03:30
parent 8ab33b4e93
commit 79ff139779
9 changed files with 136 additions and 140 deletions
+7 -1
View File
@@ -17,8 +17,14 @@ function ListDoctors({
const [loading, setLoading] = useState(false);
const router = useRouter();
const changePage = (_, num) => {
const changePage =async (_, num) => {
setLoading(true);
// 👇 اسکرول به بالا با انیمیشن
window.scrollTo({ top: 0, behavior: "smooth" });
// 👇 کمی تاخیر برای نمایش نرم‌تر
await new Promise((res) => setTimeout(res, 300));
const searchParams = new URLSearchParams(window.location.search);
searchParams.set("page", num);
router.push(`?${searchParams.toString()}`);