Skip to content
Merged
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
3 changes: 3 additions & 0 deletions apps/X/app/components/SigninComp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const SigninComp = () => {
return <div className="bg-red-600">SigninComponent</div>;
};
8 changes: 8 additions & 0 deletions apps/X/app/components/SigninRightComp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const SigninRightComp = () => {
return (
<div>
<div className="bg-red-300">Happening Now</div>
<div>Join Today.</div>
</div>
);
};
3 changes: 3 additions & 0 deletions apps/X/app/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { SigninComp } from "./SigninComp";

export { SigninComp };
4 changes: 4 additions & 0 deletions apps/X/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
--background: #ffffff;
--foreground: #171717;
Expand Down
42 changes: 17 additions & 25 deletions apps/X/app/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import db from "@repo/db/client";
import bcrypt from "bcrypt";
import { Session } from "inspector/promises";
import { JWT } from "next-auth/jwt";

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

callbacks: {
async session({ token, session }: { token: JWT; session: any }) {
session.user.id = token.sub;
return session;
async jwt({ token }: { token: JWT }) {
console.log(token, "this is the userToken");

return token;
},
async signIn({ user, account, profile }: any) {
if (account?.privider === "github" || account?.provider === "google") {
const existingUser = await db.user.findUnique({
where: { email: user.email },
});
if (!existingUser) {
try {
await db.user.create({
data: {
email: user.email,
name: user.name,
username: user.email.split("@")[0],
password: "",
},
});
} catch (error) {
console.log("Error while creating user from Github", error);
// return false;
}
}

async session({ session, token }: any) {
const user = await db.user.findUnique({
where: { id: token.sub },
});
console.log(user, "Thsi is the user");

if (token) {
session.accessToken = token.accessToken;
console.log(session.accessToken, " This is from the sesson function 1");
session.userid = token.sub;
console.log(session.userid, " This is from the sesson function 2");
}
return true;
return session;
},
},
page: {
Expand Down
13 changes: 13 additions & 0 deletions apps/X/app/signin/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { SigninComp } from "../components";

const SignIn = () => {
return (
<div>
<div className="bg-red-500">
<SigninComp />
</div>
</div>
);
};

export default SignIn;
3 changes: 3 additions & 0 deletions apps/X/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
"@types/node": "^20",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.49",
"tailwindcss": "^3.4.17",
"typescript": "5.5.4"
}
}
Loading
Loading