loading ,page
This commit is contained in:
@@ -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()}`);
|
||||
|
||||
Reference in New Issue
Block a user