1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-28 23:15:48 -04:00

add typings to pages/api/hits.ts

This commit is contained in:
2022-02-10 19:56:26 -05:00
parent d598f5023f
commit 3f08782cab
6 changed files with 152 additions and 141 deletions

View File

@@ -24,7 +24,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
res.setHeader("Pragma", "no-cache");
if (req.method !== "POST") {
return res.status(405).end(); // 405 Method Not Allowed
// 405 Method Not Allowed
return res.status(405).end();
}
const { body } = req;
@@ -52,7 +53,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
throw new Error("AIRTABLE_API_ERROR");
}
// return in JSON format
// success! let the client know
return res.status(200).json({ success: true });
} catch (error) {
console.error(error);
@@ -84,9 +85,9 @@ const validateCaptcha = async (formResponse) => {
}),
});
const result = await response.json();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const result: any = await response.json();
// @ts-ignore
return result.success;
};