Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions apps/merchant-app/app/api/user/route.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
6 changes: 6 additions & 0 deletions apps/merchant-app/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@

import { useBalance } from "@repo/store/balance";




export default function() {
const balance = useBalance();
return <div>
<div>
added a new div here
</div>
hi there {balance}
</div>
}
30 changes: 15 additions & 15 deletions apps/merchant-app/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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
}
});

Expand Down
Loading