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:
@@ -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
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user