common get post method, and control, edit page

This commit is contained in:
2023-02-04 01:04:16 +08:00
parent e77173a8af
commit 849aecac6b
12 changed files with 175 additions and 537 deletions

11
pages/api/config.ts Normal file
View File

@@ -0,0 +1,11 @@
import type { NextApiRequest, NextApiResponse } from "next";
import config from "@/config";
export default function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method === "POST") {
// update config
config.begin = req.body.begin ?? config.begin;
config.limit = req.body.limit ?? config.limit;
}
res.status(200).json(config);
}