This commit is contained in:
2023-02-16 22:57:46 +08:00
parent 4bbdac8abe
commit 4ebe5026ed
6 changed files with 99 additions and 20 deletions

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

@@ -0,0 +1,16 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { regular } 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;
}
regular.update(req.body);
}
res.status(200).json(regular.get());
}