common get post method, and control, edit page
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user