cleaner landing page

This commit is contained in:
m5r
2022-07-09 01:34:18 +02:00
parent 9e783b506d
commit 27f8ed4c7c
29 changed files with 425 additions and 492 deletions

View File

@ -0,0 +1,12 @@
import config from "~/config/config.server";
const { webhookId, webhookToken } = config.discord;
export function executeWebhook(email: string) {
const url = `https://discord.com/api/webhooks/${webhookId}/${webhookToken}`;
return fetch(url, {
body: JSON.stringify({ content: `\`${email}\` just joined Shellphone's waitlist` }),
headers: { "Content-Type": "application/json" },
method: "post",
});
}

View File

@ -0,0 +1,22 @@
import config from "~/config/config.server";
export async function addSubscriber(email: string) {
const { apiKey, audienceId } = config.mailchimp;
const region = apiKey.split("-")[1];
const url = `https://${region}.api.mailchimp.com/3.0/lists/${audienceId}/members`;
const data = {
email_address: email,
status: "subscribed",
};
const base64ApiKey = Buffer.from(`any:${apiKey}`).toString("base64");
const headers = {
"Content-Type": "application/json",
Authorization: `Basic ${base64ApiKey}`,
};
return fetch(url, {
body: JSON.stringify(data),
headers,
method: "post",
});
}