More app directory refactoring
This commit is contained in:
parent
b312a8c862
commit
8bbeaa25cf
55 changed files with 903 additions and 899 deletions
|
|
@ -1,12 +1,13 @@
|
|||
/* eslint-disable no-restricted-syntax */
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { Client } from "@opensearch-project/opensearch";
|
||||
import { v4 as uuid } from "uuid";
|
||||
import taxonomy from "app/_config/taxonomy.json";
|
||||
import unRegions from "app/_config/unRegions.json";
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const { headers: { authorization }, body: { tickets } } = req;
|
||||
export const POST = async (req: NextRequest) => {
|
||||
const { tickets } = await req.json();
|
||||
const authorization = req.headers.get("authorization");
|
||||
const baseURL = `https://${process.env.OPENSEARCH_URL}`;
|
||||
const client = new Client({
|
||||
node: baseURL,
|
||||
|
|
@ -48,7 +49,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||
}
|
||||
|
||||
const results = { succeeded, failed };
|
||||
return res.json(results);
|
||||
|
||||
return NextResponse.json(results);
|
||||
};
|
||||
|
||||
export default handler;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue