Skip to content
Snippets Groups Projects
Commit b5c967f6 authored by William Faircloth's avatar William Faircloth :speech_balloon:
Browse files

Merge branch 'patch-webhook' into 'main'

fix env loading, add undefined check for webhook url

See merge request !4
parents 6922cbe2 a756b9f9
No related branches found
No related tags found
1 merge request!4fix env loading, add undefined check for webhook url
Pipeline #6381 failed
import type { Actions } from './$types';
import * as env from '$env/static/private';
import { env } from '$env/dynamic/private';
import { building } from '$app/environment';
import { Blob } from 'node:buffer';
export const actions = {
submitFeedback: async (event) => {
......@@ -26,12 +27,18 @@ export const actions = {
}]
}));
const webhookUrl = env.WEBHOOK;
if (!webhookUrl) {
console.error("WEBHOOK URL is not defined");
return { success: false };
}
if (!building) {
await fetch(env.WEBHOOK, {
await fetch(webhookUrl, {
method: 'POST',
body: formData,
});
}
}
return {
success: true,
......@@ -43,4 +50,4 @@ export const actions = {
};
}
}
} satisfies Actions;
} satisfies Actions;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment