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

View File

@@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from "next";
import store from "@/store";
import {store, html} from "@/store";
export default function handler(
req: NextApiRequest,
@@ -9,15 +9,7 @@ export default function handler(
// update store
console.log('admin', req.body)
const json = req.body
for (const key in json) {
store[key] = json[key];
}
const keys = Object.keys(json)
for (const key in store) {
if (json[key] === undefined) {
delete store[key]
}
}
store.update(json)
}
res.status(200).json(store);
res.status(200).json(store.get());
}