add loading for redirect button from home to doctors page && change filter for field search in name or specialty and set in url && fix bug select city in home page

This commit is contained in:
ehsan
2025-09-21 23:12:47 +03:30
parent dfc8492afa
commit e11f4ed3c5
8 changed files with 75 additions and 22 deletions
+1 -2
View File
@@ -28,9 +28,8 @@ function ItemUser({ update, setUpdate, data }) {
try {
const res = await request.postCommentsLike(body);
console.log(res);
} catch (err) {
console.log(err);
// err
} finally {
if (type === "like") setLoadingLike(false);
else setLoadingDislike(false);
+14 -3
View File
@@ -9,12 +9,23 @@ async function Doctors({ searchParams }) {
const API_URL = process.env.NEXT_PUBLIC_API_URL;
let doctors = null;
const stateParams = searchParams.state;
const cityParams = searchParams.city;
try {
let newSearchParams = searchParams;
if (matchedCity && matchedCity.id !== "63")
// Conditional State
if (stateParams) newSearchParams.state = stateParams;
else if (matchedState) newSearchParams.state = matchedState.name;
// Conditional City
if (cityParams) newSearchParams.city = cityParams;
else if (matchedCity && matchedCity.id !== "63")
newSearchParams.city = matchedCity.name;
if (matchedState) newSearchParams.state = matchedState.name;
const params = buildDoctorParams(searchParams);
const params = buildDoctorParams(newSearchParams);
const response = await axios.get(`${API_URL}/api/v1/doctors`, {
params,