Files
nobat724_front/app/doctors/page.js
T

36 lines
874 B
JavaScript

import DoctorsPage from "@/components/doctors";
import Layout from "@/components/layout/StLayout";
import { getStateInfo } from "@/lib/getStateInfo";
import axios from "axios";
async function Doctors({ searchParams }) {
const { matchedCity, matchedState } = getStateInfo();
const API_URL = process.env.NEXT_PUBLIC_API_URL;
let doctors = null;
try {
const params = {};
if (matchedCity) params.city = matchedCity?.id || null;
if (matchedState) params.state = matchedState?.id || null;
const response = await axios.get(`${API_URL}/api/v1/doctors`, {
params,
});
doctors = response.data.data;
} catch (error) {}
return (
<Layout>
<DoctorsPage
list={doctors}
params={searchParams}
matchedCity={matchedCity}
matchedState={matchedState}
/>
</Layout>
);
}
export default Doctors;