seperate regular

This commit is contained in:
2023-04-26 23:19:42 +08:00
parent 6d2c0d8cb3
commit 89124b9ad9
7 changed files with 71 additions and 10 deletions

16
pages/api/html-regular.ts Normal file
View File

@@ -0,0 +1,16 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { htmlRegular } from "@/store";
import config from "@/config";
export default function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method === "POST") {
if (req.headers.token !== config.token) {
res.status(403).json({ error: "wrong token" });
return;
}
htmlRegular.set(req.body.html);
}
res.status(200).json({
html: htmlRegular.get(),
});
}