import type { NextApiRequest, NextApiResponse } from "next"; import store from "@/store"; export default function handler( req: NextApiRequest, res: NextApiResponse>, ) { if (req.method === 'POST') { // 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] } } } res.status(200).json(store); }