14 lines
477 B
TypeScript
14 lines
477 B
TypeScript
import {NextApiHandler} from "next";
|
|
import {Dict, Group} from "../../src/types";
|
|
import {setGroups} from "../../src/database/groups";
|
|
|
|
const handler: NextApiHandler = async (req, res) => {
|
|
if (req.method !== 'POST') throw new Error('Invalid method')
|
|
const {groups, ignored, base} = req.body as {groups: Dict<Group>, ignored: string[], base: string[]}
|
|
const uuid = await setGroups(groups, ignored, base)
|
|
console.log(uuid)
|
|
res.json({ uuid })
|
|
}
|
|
|
|
export default handler
|