blob: b60c76efa1d83672957785845de8acc80fa7da0f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import { NextRequest, NextResponse } from "next/server";
import { createUserServiceClient } from "@/client/client";
import { RequestBody, ResponseBody } from "@/app/api/new-user/verify-username/types";
import { withApiAuthRequired } from "@auth0/nextjs-auth0";
export const POST = withApiAuthRequired(async function(request: NextRequest) {
const { username } = RequestBody.parse(await request.json());
const client = createUserServiceClient();
const { exists } = await client.checkIBDUsername({ ibdUsername: username });
const ret: ResponseBody = { exists };
return NextResponse.json(ret, { status: 200 });
});
|