mirror of
https://github.com/JOYCEQL/magic-resume.git
synced 2026-06-01 23:38:48 +02:00
feat: update PDF generation endpoint to use direct URL and enable CORS
This commit is contained in:
@@ -10,15 +10,6 @@ const config = {
|
||||
ignoreBuildErrors: true,
|
||||
},
|
||||
output: "standalone",
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: "/generate-pdf",
|
||||
destination:
|
||||
"http://1255612844-0z3iovadu8.ap-chengdu.tencentscf.com/generate-pdf",
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default withNextIntl(config);
|
||||
|
||||
@@ -111,17 +111,22 @@ const PdfExport = () => {
|
||||
optimizeImages(clonedElement),
|
||||
]);
|
||||
|
||||
const response = await fetch("/generate-pdf", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
content: clonedElement.outerHTML,
|
||||
styles,
|
||||
margin: globalSettings.pagePadding,
|
||||
}),
|
||||
});
|
||||
const response = await fetch(
|
||||
"http://1255612844-0z3iovadu8.ap-chengdu.tencentscf.com/generate-pdf",
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
content: clonedElement.outerHTML,
|
||||
styles,
|
||||
margin: globalSettings.pagePadding,
|
||||
}),
|
||||
// 允许跨域请求
|
||||
mode: "cors",
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`PDF generation failed: ${response.status}`);
|
||||
|
||||
Reference in New Issue
Block a user