- Fix GPS map links always sending literal "latitude"/"longitude" strings instead of actual coordinates in openLocation/Content.js - Add api.clinic-pro.ir to next.config.js remotePatterns so production images load correctly - Fix appointment page: await params and getStateInfo (Next.js 15 pattern) - Enable 401 handling in api.js: clear cookies and redirect to /login - Move OAuth client_secret to server-side API routes (/api/auth/token, /api/auth/refresh) so it is never bundled into client-side JavaScript - Update SendReq, SubmitData, ButtonSendData to call API routes instead of directly sending client_secret from the browser - Update docker-compose.yml to use server-only CLIENT_SECRET env var - Remove debug console.log from clinic doctors list component Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
944 B
JavaScript
36 lines
944 B
JavaScript
import AppointmentPage from "@/components/appointment";
|
|
import { getStateInfo } from "@/lib/getStateInfo";
|
|
import axios from "axios";
|
|
|
|
async function Appointment({ params }) {
|
|
const { doctorId } = await params;
|
|
const { matchedCity } = await getStateInfo();
|
|
const API_URL = process.env.NEXT_PUBLIC_API_URL;
|
|
|
|
let doctor = null;
|
|
let disabledDates = [];
|
|
|
|
try {
|
|
const doctorRes = await axios.get(`${API_URL}/api/v1/doctor/${doctorId}`);
|
|
doctor = doctorRes.data;
|
|
|
|
if (doctor && doctor.id) {
|
|
const disabledDatesRes = await axios.get(
|
|
`${API_URL}/api/v1/appointment/not-available/${doctor.id}`,
|
|
{ headers: { "Content-Type": "application/json" } }
|
|
);
|
|
disabledDates = disabledDatesRes.data?.data || [];
|
|
}
|
|
} catch (error) {}
|
|
|
|
return (
|
|
<AppointmentPage
|
|
doctor={doctor}
|
|
disabledDates={disabledDates}
|
|
matchedCity={matchedCity}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export default Appointment;
|