Force auth
This commit is contained in:
parent
1cc1beb63e
commit
c8aefcab04
5 changed files with 26 additions and 9 deletions
|
|
@ -18,10 +18,10 @@ export async function POST(req: Request) {
|
|||
const { messages, previewToken } = json
|
||||
const session = await auth()
|
||||
|
||||
if (process.env.VERCEL_ENV === 'preview') {
|
||||
if (session == null) {
|
||||
return new Response('Unauthorized', { status: 401 })
|
||||
}
|
||||
if (session == null) {
|
||||
return new Response('Unauthorized', {
|
||||
status: 401
|
||||
})
|
||||
}
|
||||
|
||||
if (previewToken) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
import { auth } from '@/auth'
|
||||
import { LoginButton } from '@/components/login-button'
|
||||
import { redirect } from 'next/navigation'
|
||||
|
||||
export default function SignInPage() {
|
||||
export default async function SignInPage() {
|
||||
const session = await auth()
|
||||
// redirect to home if user is already logged in
|
||||
if (session?.user) {
|
||||
redirect('/')
|
||||
}
|
||||
return (
|
||||
<div className="flex h-[calc(100vh-theme(spacing.16))] items-center justify-center py-10">
|
||||
<LoginButton />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue