mirror of
https://github.com/DerTyp7/f1r3wave-website.git
synced 2025-10-30 05:27:09 +01:00
first commit
This commit is contained in:
21
src/auth.config.ts
Normal file
21
src/auth.config.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { NextAuthConfig } from 'next-auth';
|
||||
|
||||
export const authConfig = {
|
||||
pages: {
|
||||
signIn: '/login',
|
||||
},
|
||||
callbacks: {
|
||||
authorized({ auth, request: { nextUrl } }) {
|
||||
const isLoggedIn = !!auth?.user;
|
||||
|
||||
const isOnAdminRoute = nextUrl.pathname.startsWith('/admin');
|
||||
|
||||
if (isOnAdminRoute) {
|
||||
if (isLoggedIn) return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
providers: [],
|
||||
} satisfies NextAuthConfig;
|
||||
Reference in New Issue
Block a user