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 }],
|
replyTo: [{ address: email }],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const apiBase = endpoint.replace(/\/$/, "");
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${endpoint.replace(/\\/$/, "")}/emails:send?api-version=2023-03-31`,
|
apiBase + "/emails:send?api-version=2023-03-31",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -150,10 +151,7 @@ const handlePost: PagesFunction<Env> = async ({ request, env }) => {
|
||||||
|
|
||||||
export const onRequest: PagesFunction<Env> = async (context) => {
|
export const onRequest: PagesFunction<Env> = async (context) => {
|
||||||
if (context.request.method !== "POST") {
|
if (context.request.method !== "POST") {
|
||||||
return jsonResponse(
|
return jsonResponse({ ok: false, error: "Method not allowed." }, 405);
|
||||||
{ ok: false, error: "Method not allowed." },
|
|
||||||
405,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return handlePost(context);
|
return handlePost(context);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
"assets": {
|
"assets": {
|
||||||
"directory": "./dist/public",
|
"directory": "./dist/public",
|
||||||
"binding": "ASSETS",
|
"binding": "ASSETS",
|
||||||
"not_found_handling": "single-page-application",
|
"not_found_handling": "single-page-application"
|
||||||
},
|
},
|
||||||
"vars": {
|
"vars": {
|
||||||
"CONTACT_FROM_EMAIL": "info@highlandgrouprda.org.uk",
|
"CONTACT_FROM_EMAIL": "info@highlandgrouprda.org.uk",
|
||||||
"CONTACT_TO_EMAIL": "info@highlandgrouprda.org.uk",
|
"CONTACT_TO_EMAIL": "info@highlandgrouprda.org.uk"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue