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
10 changes: 5 additions & 5 deletions apps/merchant-app/app/api/user/route.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { NextResponse } from "next/server"
import { PrismaClient } from "@repo/db/client";

const client = new PrismaClient();
import prisma from "@repo/db/client";

export const GET = async () => {
await client.user.create({
await prisma.user.create({
data: {
email: "asd",
name: "adsads"
name: "adsads",
password:"lol",
number:"123"
}
})
return NextResponse.json({
Expand Down
30 changes: 19 additions & 11 deletions apps/merchant-app/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import GoogleProvider from "next-auth/providers/google";
import db from "@repo/db/client";
import { Account, Profile, User } from "next-auth";

export const authOptions = {
providers: [
Expand All @@ -9,15 +10,22 @@ export const authOptions = {
})
],
callbacks: {
async signIn({ user, account }: {
user: {
email: string;
name: string
},
account: {
provider: "google" | "github"
}
}) {


async signIn({
user,
account,
profile,
email,
credentials,
}: {
user: User;
account: Account | null;
profile?: Profile;
email?: { verificationRequest?: boolean };
credentials?: Record<string, any>;
})
{
console.log("hi signin")
if (!user || !user.email) {
return false;
Expand All @@ -33,11 +41,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
2 changes: 1 addition & 1 deletion packages/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"recoil": "^0.7.7"
},
"exports": {
"./balance": "./src/hooks/useBalance"
"./balance": "./src/hooks/useBalance.ts"
}
}