mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 10:36:44 +00:00
20 lines
511 B
TypeScript
20 lines
511 B
TypeScript
import { server, verifyEmail } from "#/lib/zitadel";
|
|
import { NextRequest, NextResponse } from "next/server";
|
|
|
|
export async function POST(request: NextRequest) {
|
|
const body = await request.json();
|
|
if (body) {
|
|
const { userId, code } = body;
|
|
|
|
return verifyEmail(server, userId, code)
|
|
.then((resp) => {
|
|
return NextResponse.json(resp);
|
|
})
|
|
.catch((error) => {
|
|
return NextResponse.json(error, { status: 500 });
|
|
});
|
|
} else {
|
|
return NextResponse.error();
|
|
}
|
|
}
|