Webcreat / middlewares /checkUser.js
arkleinberg's picture
Upload 40 files
e061365 verified
raw
history blame contribute delete
316 Bytes
export default async function checkUser(req, res, next) {
if (process.env.HF_TOKEN && process.env.HF_TOKEN !== "") {
return next();
}
const { hf_token } = req.cookies;
if (!hf_token) {
return res.status(401).send({
ok: false,
message: "Unauthorized",
});
}
next();
}