fix pages config
This commit is contained in:
parent
00f6ea6b52
commit
29da1ccec7
2 changed files with 15 additions and 17 deletions
|
|
@ -122,8 +122,9 @@ const handlePost: PagesFunction<Env> = async ({ request, env }) => {
|
|||
replyTo: [{ address: email }],
|
||||
};
|
||||
|
||||
const apiBase = endpoint.replace(/\/$/, "");
|
||||
const response = await fetch(
|
||||
`${endpoint.replace(/\\/$/, "")}/emails:send?api-version=2023-03-31`,
|
||||
apiBase + "/emails:send?api-version=2023-03-31",
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
@ -150,10 +151,7 @@ const handlePost: PagesFunction<Env> = async ({ request, env }) => {
|
|||
|
||||
export const onRequest: PagesFunction<Env> = async (context) => {
|
||||
if (context.request.method !== "POST") {
|
||||
return jsonResponse(
|
||||
{ ok: false, error: "Method not allowed." },
|
||||
405,
|
||||
);
|
||||
return jsonResponse({ ok: false, error: "Method not allowed." }, 405);
|
||||
}
|
||||
return handlePost(context);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
"name": "rda-2026",
|
||||
"main": "src/worker.ts",
|
||||
"compatibility_date": "2025-12-21",
|
||||
"assets": {
|
||||
"directory": "./dist/public",
|
||||
"binding": "ASSETS",
|
||||
"not_found_handling": "single-page-application",
|
||||
},
|
||||
"vars": {
|
||||
"CONTACT_FROM_EMAIL": "info@highlandgrouprda.org.uk",
|
||||
"CONTACT_TO_EMAIL": "info@highlandgrouprda.org.uk",
|
||||
},
|
||||
"name": "rda-2026",
|
||||
"main": "src/worker.ts",
|
||||
"compatibility_date": "2025-12-21",
|
||||
"assets": {
|
||||
"directory": "./dist/public",
|
||||
"binding": "ASSETS",
|
||||
"not_found_handling": "single-page-application"
|
||||
},
|
||||
"vars": {
|
||||
"CONTACT_FROM_EMAIL": "info@highlandgrouprda.org.uk",
|
||||
"CONTACT_TO_EMAIL": "info@highlandgrouprda.org.uk"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue