chore: code cleaning (#21)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import prisma from '@prisma/prisma';
|
||||
import { ApiResponse } from '@utils/apiResponse';
|
||||
import { formatApiResponse } from '@utils/formatApiResponse';
|
||||
import {
|
||||
BAD_REQUEST,
|
||||
INTERNAL_SERVER_ERROR,
|
||||
@@ -21,7 +21,7 @@ export async function POST(request: NextRequest) {
|
||||
const body = await request.json();
|
||||
const validation = ConfirmationSchema.safeParse(body);
|
||||
if (!validation.success || !validation.data.code) {
|
||||
return ApiResponse(STATUS_BAD_REQUEST, BAD_REQUEST);
|
||||
return formatApiResponse(STATUS_BAD_REQUEST, BAD_REQUEST);
|
||||
}
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
@@ -53,10 +53,13 @@ export async function POST(request: NextRequest) {
|
||||
message: `Thank you for confirming the subscription, ${user.email}!`
|
||||
};
|
||||
|
||||
return ApiResponse(STATUS_OK, message);
|
||||
return formatApiResponse(STATUS_OK, message);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return ApiResponse(STATUS_INTERNAL_SERVER_ERROR, INTERNAL_SERVER_ERROR);
|
||||
return formatApiResponse(
|
||||
STATUS_INTERNAL_SERVER_ERROR,
|
||||
INTERNAL_SERVER_ERROR
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user