diff --git a/apps/merchant-app/app/api/user/route.ts b/apps/merchant-app/app/api/user/route.ts index 022d132..873cf31 100644 --- a/apps/merchant-app/app/api/user/route.ts +++ b/apps/merchant-app/app/api/user/route.ts @@ -1,13 +1,17 @@ -import { NextResponse } from "next/server" -import prisma from "@repo/db/client"; +import { NextResponse } from "next/server"; +import prisma from "@repo/db/client"; export const GET = async () => { - await prisma.user.create({ - data: { - email: "asd", - name: "adsads", - number:"123456", - password:"90900" + await prisma.user.upsert({ + where: { + email: "asd"}, + update:{}, + create:{ + email:"add", + name: "adsads", + password:"secret", + number:"123" + } }) return NextResponse.json({ diff --git a/apps/merchant-app/app/page.tsx b/apps/merchant-app/app/page.tsx index f72d01d..c44a015 100644 --- a/apps/merchant-app/app/page.tsx +++ b/apps/merchant-app/app/page.tsx @@ -2,9 +2,15 @@ import { useBalance } from "@repo/store/balance"; + + + export default function() { const balance = useBalance(); return
+
+ added a new div here +
hi there {balance}
} \ No newline at end of file diff --git a/apps/merchant-app/lib/auth.ts b/apps/merchant-app/lib/auth.ts index 8d38ac0..b429d48 100644 --- a/apps/merchant-app/lib/auth.ts +++ b/apps/merchant-app/lib/auth.ts @@ -9,19 +9,19 @@ export const authOptions = { }) ], callbacks: { - async signIn({ user, account }: { - user: { - email: string; - name: string - }, - account: { - provider: "google" | "github" - } - }) { - console.log("hi signin") - if (!user || !user.email) { - return false; - } + async signIn(params: { + user: { email?: string | null; name?: string | null; [key: string]: any }; + account: { provider: string } | null; + profile?: any; + email?: any; + credentials?: any; + }) { + const { user, account } = params; + + console.log("hi signin"); + if (!user || !user.email) { + return false; + } await db.merchant.upsert({ select: { @@ -33,11 +33,11 @@ export const authOptions = { create: { email: user.email, name: user.name, - auth_type: account.provider === "google" ? "Google" : "Github" // Use a prisma type here + auth_type: account?.provider === "google" ? "Google" : "Github" // Use a prisma type here }, update: { name: user.name, - auth_type: account.provider === "google" ? "Google" : "Github" // Use a prisma type here + auth_type: account?.provider === "google" ? "Google" : "Github" // Use a prisma type here } });