diff --git a/app/api/leads/route.ts b/app/api/leads/route.ts index e7ac2c8..22efa39 100644 --- a/app/api/leads/route.ts +++ b/app/api/leads/route.ts @@ -1,7 +1,11 @@ -import { auth } from "@/auth"; -import { NextResponse } from "next/server"; -import { isAuthenticated } from "@/lib/utils"; -import { ApiResponse, errorResponse, handleApiResponse } from "@/lib/response"; +import { auth } from '@/auth'; +import { NextResponse } from 'next/server'; +import { isAuthenticated } from '@/lib/utils'; +import { + ApiResponse, + errorResponse, + handleApiResponse, +} from '@/app/util/response'; export async function POST( request: Request, @@ -9,16 +13,16 @@ export async function POST( const session = await auth(); if (!isAuthenticated(session)) { return errorResponse( - "You need to be authenticated to access this endpoint", + 'You need to be authenticated to access this endpoint', 401, ); } const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/leads`, { - method: "POST", + method: 'POST', headers: { Authorization: `Bearer ${session!.token}`, - "Content-Type": "application/json", + 'Content-Type': 'application/json', }, }); @@ -26,8 +30,8 @@ export async function POST( const data = await apiResponse.json(); if (data.success) { - const leadUrl = res.headers.get("Location")!; - const leadUrlParts = leadUrl.split("/"); + const leadUrl = res.headers.get('Location')!; + const leadUrlParts = leadUrl.split('/'); const leadId = leadUrlParts[leadUrlParts.length - 1]; return NextResponse.json( diff --git a/app/pricing/components/Pricing.tsx b/app/pricing/components/Pricing.tsx index 68c9945..43e146a 100644 --- a/app/pricing/components/Pricing.tsx +++ b/app/pricing/components/Pricing.tsx @@ -4,7 +4,7 @@ import { Button } from '@nextui-org/button'; import { signIn, useSession } from 'next-auth/react'; import { isAuthenticated } from '@/lib/utils'; import toast from 'react-hot-toast'; -import { ApiResponse } from '@/lib/response'; +import { ApiResponse } from '@/app/util/response'; import { useCallback, useState } from 'react'; export default function Pricing() {