-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: set up database and auth #178
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! Keep going 🚀🔥🐳
app/app/api/auth/[...nextauth].ts
Outdated
|
||
export const authOptions: NextAuthOptions = { | ||
adapter: PrismaAdapter(db), | ||
secret: process.env.NEXTAUTH_SECRET, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add this var in /app/env.mjs
, so it is checked at build time?
https://github.com/t3-oss/t3-env
You can then use it with typesafety by using import { env } from "env.mjs";
app/app/api/user/route.ts
Outdated
|
||
return NextResponse.json({ user: rest, message: "Great success!"}, { status : 201 }); | ||
} catch(error) { | ||
return NextResponse.json({message: "Error!"}, { status : 500}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just throwing an error should lead to a response with error code 500. Additionaly you get the error wrapped in the response so you can see the error code in the client - The only thing you have to be careful about is that you don't expose sensitive information
redirect: false | ||
}); | ||
if(signInData?.error) { | ||
console.log(signInData.error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log(signInData.error); | |
console.error(signInData.error); |
updated_at DateTime @updatedAt | ||
} | ||
|
||
enum ContactType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing!
app/types/next-auth.d.ts
Outdated
username: string | ||
} | ||
interface Session { | ||
user: User & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this just the User
interface above?
app/types/next-auth.d.ts
Outdated
user: User & { | ||
username: string | ||
} | ||
token: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this as well
@simon-hng is attempting to deploy a commit to a Personal Account on Vercel that is not owned by them. In order for the commit to be deployed, @simon-hng must be granted access to the connected Vercel project. If you're the owner of the Personal Account, transfer the project to a Vercel Team and start collaborating, or learn more. |
Co-authored-by: Sofiia Danylchenko <[email protected]> Co-authored-by: simonhng <[email protected]>
Co-authored-by: Cyro292 <[email protected]> Co-authored-by: simonhng <[email protected]> Co-authored-by: Behsad Riemer <[email protected]>
Setup with prisma, basic auth concept with email/password login
Possible future improvements: