-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
35 lines (28 loc) · 889 Bytes
/
index.ts
File metadata and controls
35 lines (28 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
declare var WEBHOOK_URL: string;
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request: Request): Promise<Response> {
const { pathname } = new URL(request.url);
switch (pathname) {
case "/api/apply":
const formData = await request.formData();
const email = formData.get("email");
const user = formData.get("ubisoftAccount");
const message = `A new nerd thinks he's good enough to join T3ST
Email: ${email}
Username: ${user}`;
await fetch(WEBHOOK_URL, {
method: "POST",
body: JSON.stringify({
content: message,
}),
headers: {
"content-type": "application/json",
},
});
return Response.redirect("https://t3st.games");
default:
return Response.redirect("https://t3st.games");
}
}