1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 19:01:17 -04:00

run prettier over every file

This commit is contained in:
2021-10-31 16:51:19 -04:00
parent f4ebeeb1b8
commit c7fdda36af
16 changed files with 34 additions and 79 deletions

View File

@@ -4,8 +4,7 @@ import queryString from "query-string";
// fallback to dummy secret for testing: https://docs.hcaptcha.com/#integration-testing-test-keys
const HCAPTCHA_SITE_KEY = process.env.HCAPTCHA_SITE_KEY || "10000000-ffff-ffff-ffff-000000000001";
const HCAPTCHA_SECRET_KEY =
process.env.HCAPTCHA_SECRET_KEY || "0x0000000000000000000000000000000000000000";
const HCAPTCHA_SECRET_KEY = process.env.HCAPTCHA_SECRET_KEY || "0x0000000000000000000000000000000000000000";
const HCAPTCHA_API_ENDPOINT = "https://hcaptcha.com/siteverify";
const { AIRTABLE_API_KEY, AIRTABLE_BASE } = process.env;
@@ -37,9 +36,8 @@ export default async (req, res) => {
const { body } = req;
// these are both backups to client-side validations just in case someone
// squeezes through without them. the codes are identical so they're caught
// in the same fashion.
// these are both backups to client-side validations just in case someone squeezes through without them. the codes
// are identical so they're caught in the same fashion.
if (!body.name || !body.email || !body.message) {
// all fields are required
throw new Error("USER_MISSING_DATA");

View File

@@ -27,11 +27,7 @@ export default async (req, res) => {
if (req.method !== "GET") {
throw new Error(`Method ${req.method} not allowed.`);
}
if (
!process.env.SPOTIFY_CLIENT_ID ||
!process.env.SPOTIFY_CLIENT_SECRET ||
!process.env.SPOTIFY_REFRESH_TOKEN
) {
if (!process.env.SPOTIFY_CLIENT_ID || !process.env.SPOTIFY_CLIENT_SECRET || !process.env.SPOTIFY_REFRESH_TOKEN) {
throw new Error("Spotify API credentials aren't set.");
}
@@ -47,10 +43,7 @@ export default async (req, res) => {
response = await getTopTracks();
// let Vercel edge and browser cache results for 3 hours
res.setHeader(
"Cache-Control",
"public, max-age=10800, s-maxage=10800, stale-while-revalidate"
);
res.setHeader("Cache-Control", "public, max-age=10800, s-maxage=10800, stale-while-revalidate");
}
res.setHeader("Access-Control-Allow-Methods", "GET");