common get post method, and control, edit page
This commit is contained in:
11
pages/api/config.ts
Normal file
11
pages/api/config.ts
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user