Skip to content

Commit

Permalink
fix: 移除 authjs,新增 prisma
Browse files Browse the repository at this point in the history
  • Loading branch information
besscroft committed Apr 5, 2024
1 parent 2b36078 commit 49cb07d
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 370 deletions.
14 changes: 2 additions & 12 deletions .env
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
# Postgre 主机
POSTGRE_HOST="localhost"
# Postgre 端口
POSTGRE_PORT=5432
# Postgre 数据库
POSTGRE_DATABASE="postgres"
# Postgre 用户名
POSTGRE_USERNAME="postgres"
# Postgre 密码
POSTGRE_PASSWORD="postgres"
# AUTH_SECRET npx auth secret
AUTH_SECRET="T7tQXKqqKjZrJhN62Z05AHY8qKGQKaG/4iqv0tKmEvw="
# 数据库 url
DATABASE_URL="db.picimpact.supabase.co"
14 changes: 2 additions & 12 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
# Postgre 主机
POSTGRE_HOST="db.picimpact.supabase.co"
# Postgre 端口
POSTGRE_PORT=5432
# Postgre 数据库
POSTGRE_DATABASE="postgres"
# Postgre 用户名
POSTGRE_USERNAME="postgres"
# Postgre 密码
POSTGRE_PASSWORD="postgres"
# AUTH_SECRET npx auth secret
AUTH_SECRET="T7tQXKqqKjZrJhN62Z05AHY8qKGQKaG/4iqv0tKmEvw="
# 数据库 url
DATABASE_URL="db.picimpact.supabase.co"
6 changes: 2 additions & 4 deletions app/(admin)/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { auth } from '~/utils/lib/auth'

export default async function Admin() {
const session = await auth()


return (
<>
控制台 {session?.user}
控制台
</>
)
}
27 changes: 0 additions & 27 deletions app/actions.ts

This file was deleted.

12 changes: 2 additions & 10 deletions components/UserFrom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ import { Input } from '@nextui-org/input'
import Link from 'next/link'
import { Button } from '@nextui-org/react'
import { useRouter } from 'next/navigation'
import { authenticate } from '~/app/actions'
// import { useFormState, useFormStatus } from 'react-dom'
import { toast } from 'sonner'

export const UserFrom = () => {
const router = useRouter()

// const [errorMessage, dispatch] = useFormState(authenticate, undefined)
// const { pending } = useFormStatus()

const [isLoading, setIsLoading] = useState<boolean>(false)

const [email, setEmail] = useState('')
Expand Down Expand Up @@ -63,11 +59,7 @@ export const UserFrom = () => {
type="submit"
className="w-full"
isLoading={isLoading}
onClick={async () => {
setIsLoading(true)
await authenticate(email, password)
setIsLoading(false)
}}
onClick={() => toast.info('还没写!')}
>
登录
</Button>
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"postinstall": "npx prisma migrate deploy && npx prisma generate"
},
"dependencies": {
"@auth/pg-adapter": "^0.7.2",
"@nextui-org/react": "^2.2.10",
"@prisma/client": "^5.12.1",
"framer-motion": "^11.0.24",
"next": "^14.1.4",
"next-auth": "5.0.0-beta.16",
"next-themes": "^0.3.0",
"pg": "^8.11.5",
"react": "^18.2.0",
Expand All @@ -28,13 +28,13 @@
},
"devDependencies": {
"@types/node": "^20.12.2",
"@types/pg": "^8.11.4",
"@types/react": "^18.2.73",
"@types/react-dom": "^18.2.23",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.4",
"postcss": "^8.4.38",
"prisma": "^5.12.1",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.3"
}
Expand Down
Loading

0 comments on commit 49cb07d

Please sign in to comment.