Skip to content

Commit

Permalink
fix deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanies committed Jun 17, 2024
1 parent 9860549 commit ae7b209
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/app/api/newjob/route.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { sql } from '@vercel/postgres';
import { NextResponse } from 'next/server';
import { NextRequest, NextResponse } from 'next/server';
import { auth } from '@/auth/auth';
import { getUserID, getUserName } from '@/app/utils/userInfo';



export async function POST(request: { json: () => PromiseLike<{ money: any; jobTitle: any; jobDescription: any; }> | { money: any; jobTitle: any; jobDescription: any; }; }) {
export async function POST(request: NextRequest) {
try {
const session = await auth();
if (!session || !session.user || !session.user.accessToken) {
throw new Error("Usuario no autenticado");
}

console.log(session)
console.log(session);
const { money, jobTitle, jobDescription } = await request.json();

if (!money || isNaN(money)) {
Expand All @@ -26,12 +24,11 @@ export async function POST(request: { json: () => PromiseLike<{ money: any; jobT
}

const username = await getUserName();

const userid = await getUserID();

await sql`
INSERT INTO oferta (identify, imagen, usuario, pago, descripcion, titulo)
VALUES ( ${userid} , ${session.user.image}, ${username}, ${money}, ${jobDescription}, ${jobTitle})
VALUES (${userid}, ${session.user.image}, ${username}, ${money}, ${jobDescription}, ${jobTitle})
`;

return NextResponse.json({ success: true });
Expand Down

0 comments on commit ae7b209

Please sign in to comment.