This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require("node-fetch"); | |
let slackToken = process.env.slack_token | |
function main(args) { | |
if (!args.name || !args.email || !args.message || !args.site) { | |
return {"body": "Error - missing arguments"} | |
} | |
let name = args.name | |
let email = args.email | |
let message = args.message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from "react"; | |
function Form() { | |
const [name, setName] = useState(""); | |
const [message, setMessage] = useState(""); | |
const [email, setEmail] = useState(""); | |
const [submitClicked, setSubmitClicked] = useState(); | |
const [formError, setFormError] = useState([]); | |
const submit = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Catch the incoming params | |
const incomingQueryString = window.location.search.substring(1); // drops ? from the front; | |
// Capture all of the link clicks | |
document.addEventListener(`click`, (e) => { | |
// if it's an <a> link | |
if (e.target.closest(`a`) && incomingQueryString.length > 0) { | |
e.preventDefault(); | |
// if it already has params, combine them, if not, add the new ones | |
window.location.href = |