export const SAMPLE_JOKE = {
"setup": "What do you call a group of disorganized cats?",
"punchline": "A cat-tastrophe.",
};
import { email } from "https://esm.town/v/std/email?v=9";
function fetchRandomJoke() {
const SAMPLE_JOKE = {
"setup": "What do you call a group of disorganized cats?",
"punchline": "A cat-tastrophe.",
};
return SAMPLE_JOKE;
}
const randomJoke = fetchRandomJoke();
const setup = randomJoke.setup;
const punchline = randomJoke.punchline;
export const emailRandomJoke = email({
text: punchline,
subject: setup,
});
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
);
return response.json();
}
const randomJoke = await fetchRandomJoke();
const setup = randomJoke.setup;
const punchline = randomJoke.punchline;