update api key logic

This commit is contained in:
austinkelsay 2024-10-02 17:31:57 -05:00
parent e89c5cfcd3
commit b0204d3307

View File

@ -10,7 +10,7 @@ const PLEBDEVS_API_KEY = process.env.PLEBDEVS_API_KEY;
export default async function handler(req, res) {
// make sure api key is in authorization header
const apiKey = req.headers['authorization'];
if (apiKey !== PLEBDEVS_API_KEY) {
if (!apiKey || apiKey !== PLEBDEVS_API_KEY) {
res.status(401).json({ error: 'Unauthorized' });
return;
}