Skip to content

Commit

Permalink
feat: add zod and begin server action migration
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Dec 17, 2023
1 parent 52f4a16 commit b4aa7b3
Show file tree
Hide file tree
Showing 14 changed files with 514 additions and 458 deletions.
16 changes: 13 additions & 3 deletions auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import prisma from "@/lib/prisma"

// import type { NextAuthConfig } from "next-auth"
const providers = [
process.env.GITHUB_ID ? GitHub : null,
process.env.GOOGLE_ID ? Google : null,
process.env.GITHUB_ID &&
GitHub({ clientId: process.env.GITHUB_ID, clientSecret: process.env.GITHUB_SECRET }),
process.env.GOOGLE_ID &&
Google({ clientId: process.env.GOOGLE_ID, clientSecret: process.env.GOOGLE_SECRET }),
process.env.KEYCLOAK_ID &&
Keycloak({
clientId: process.env.KEYCLOAK_ID,
Expand Down Expand Up @@ -43,10 +45,18 @@ const adapter = {
const config = {
providers,
adapter: adapter,
callbacks: {
async session({ session, user }) {
session.user.userId = user.id
return session
},
},
pages: {
signIn: "/auth/signin",
},
}
// } satisfies NextAuthConfig

export const { handlers, auth, signIn, signOut } = NextAuth(config)
const { handlers, auth, signIn, signOut } = NextAuth(config)

export { handlers, auth, signIn, signOut, providers }
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"selfhost"
],
"scripts": {
"dev": "next dev",
"dev": "next dev -p 3001",
"build": "next build",
"start": "next start",
"lint": "next lint",
Expand All @@ -38,6 +38,7 @@
"react-masonry-css": "^1.0.16",
"react-use": "^17.4.2",
"react-use-focus-trap": "1.1.7",
"zod": "^3.22.4",
"zustand": "^4.4.7"
},
"devDependencies": {
Expand Down
98 changes: 36 additions & 62 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b4aa7b3

Please # to comment.