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:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user