fix resend email

This commit is contained in:
peintnermax
2024-07-17 15:22:13 +02:00
parent 361f23fd46
commit 5e5e414040
3 changed files with 8 additions and 5 deletions

View File

@@ -1,13 +1,13 @@
import { setEmail } from "@/lib/zitadel";
import { resendEmailCode } 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;
const { userId } = body;
// replace with resend Mail method once its implemented
return setEmail(userId)
return resendEmailCode(userId)
.then((resp) => {
return NextResponse.json(resp);
})

View File

@@ -345,8 +345,8 @@ export async function verifyEmail(userId: string, verificationCode: string) {
* @param userId the id of the user where the email should be set
* @returns the newly set email
*/
export async function setEmail(userId: string) {
return userService.setEmail(
export async function resendEmailCode(userId: string) {
return userService.resendEmailCode(
{
userId,
},

View File

@@ -82,6 +82,9 @@ export default function VerifyEmailForm({
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
userId,
}),
});
const response = await res.json();