صفحات سرور (doctors, doctor/[slug], appointment/[doctorId]) از axios خام استفاده میکردند که گواهی self-signed ddev محلی را رد میکرد (unable to verify the first certificate). حالا از axiosInstance/fetchReq در lib/req استفاده میکنند که در development آن را میپذیرد. افزودن clinic-pro.ddev.site (http/https) به remotePatterns تصاویر. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
19 lines
465 B
JavaScript
19 lines
465 B
JavaScript
import axios from "axios";
|
|
import https from "https";
|
|
|
|
export const axiosInstance = axios.create({
|
|
...(process.env.NODE_ENV === "development" && {
|
|
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
|
}),
|
|
});
|
|
|
|
export const fetchReq = async (url, headers) => {
|
|
try {
|
|
const response = await axiosInstance.get(url, headers);
|
|
return response.data;
|
|
} catch (error) {
|
|
console.error("fetchReq error:", error.message);
|
|
return null;
|
|
}
|
|
};
|