| 1 | import type { NextRequest } from 'next/server' |
| 2 | |
| 3 | export const PUBLIC_ROUTES: |
| 4 | export const AUTH_PREFIX: |
| 5 | export const API_AUTH_PREFIX: |
| 6 | export const DEFAULT_LOGIN_REDIRECT: |
| 7 | |
| 8 | export function isApiAuth(pathname |
| 9 | return startsWith(pathname |
| 10 | } |
| 11 | |
| 12 | export function isAuthRoute(pathname |
| 13 | return startsWith(pathname |
| 14 | } |
| 15 | |
| 16 | export function isPublicRoute(pathname |
| 17 | return isPathEqual(pathname |
| 18 | } |
| 19 | |
| 20 | // Utils |
| 21 | function isPathEqual(pathname: |
| 22 | return paths.includes |
| 23 | } |
| 24 | |
| 25 | function startsWith(pathname: |
| 26 | return pathname.startsWith |
| 27 | } |
| 28 | |
| 29 | export function getSignInUrl(request |
| 30 | const rt = |
| 31 | return new URL |
| 32 | `${AUTH_PREFIX}/sign-in?redirectTo=${encodeURIComponent |
| 33 | request.url |
| 34 | ) |
| 35 | } |