Skip to content

Commit 58dffef

Browse files
authored
Merge pull request #12 from mscode07/dev
Fixed oth
2 parents 71da6e5 + 46a794c commit 58dffef

File tree

12 files changed

+1869
-450
lines changed

12 files changed

+1869
-450
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const SigninComp = () => {
2+
return <div className="bg-red-600">SigninComponent</div>;
3+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export const SigninRightComp = () => {
2+
return (
3+
<div>
4+
<div className="bg-red-300">Happening Now</div>
5+
<div>Join Today.</div>
6+
</div>
7+
);
8+
};

apps/X/app/components/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { SigninComp } from "./SigninComp";
2+
3+
export { SigninComp };

apps/X/app/globals.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
15
:root {
26
--background: #ffffff;
37
--foreground: #171717;

apps/X/app/lib/auth.ts

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import db from "@repo/db/client";
22
import bcrypt from "bcrypt";
3-
import { Session } from "inspector/promises";
43
import { JWT } from "next-auth/jwt";
54

65
import CredentialsProvider from "next-auth/providers/credentials";
@@ -115,32 +114,25 @@ export const authOptions = {
115114
Secret: process.env.NEXTAUTH_SECRET || "secr3t",
116115

117116
callbacks: {
118-
async session({ token, session }: { token: JWT; session: any }) {
119-
session.user.id = token.sub;
120-
return session;
117+
async jwt({ token }: { token: JWT }) {
118+
console.log(token, "this is the userToken");
119+
120+
return token;
121121
},
122-
async signIn({ user, account, profile }: any) {
123-
if (account?.privider === "github" || account?.provider === "google") {
124-
const existingUser = await db.user.findUnique({
125-
where: { email: user.email },
126-
});
127-
if (!existingUser) {
128-
try {
129-
await db.user.create({
130-
data: {
131-
email: user.email,
132-
name: user.name,
133-
username: user.email.split("@")[0],
134-
password: "",
135-
},
136-
});
137-
} catch (error) {
138-
console.log("Error while creating user from Github", error);
139-
// return false;
140-
}
141-
}
122+
123+
async session({ session, token }: any) {
124+
const user = await db.user.findUnique({
125+
where: { id: token.sub },
126+
});
127+
console.log(user, "Thsi is the user");
128+
129+
if (token) {
130+
session.accessToken = token.accessToken;
131+
console.log(session.accessToken, " This is from the sesson function 1");
132+
session.userid = token.sub;
133+
console.log(session.userid, " This is from the sesson function 2");
142134
}
143-
return true;
135+
return session;
144136
},
145137
},
146138
page: {

apps/X/app/signin/page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { SigninComp } from "../components";
2+
3+
const SignIn = () => {
4+
return (
5+
<div>
6+
<div className="bg-red-500">
7+
<SigninComp />
8+
</div>
9+
</div>
10+
);
11+
};
12+
13+
export default SignIn;

apps/X/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
"@types/node": "^20",
2626
"@types/react": "18.3.1",
2727
"@types/react-dom": "18.3.0",
28+
"autoprefixer": "^10.4.20",
29+
"postcss": "^8.4.49",
30+
"tailwindcss": "^3.4.17",
2831
"typescript": "5.5.4"
2932
}
3033
}

0 commit comments

Comments
 (0)