/** * @module middleware * @description hooks-up `next-auth` into the page processing pipeline */ import { auth } from '@/app/lib/auth' import createIntlMiddleware from 'next-intl/middleware'; const locales = ['en', 'de']; const publicPages = ['/', '/login']; const intlMiddleware = createIntlMiddleware({ locales, localePrefix: 'as-needed', defaultLocale: 'hr' }); export const config = { // midleware will NOT be called for paths: '/api/auth/*', '/_next/static/*', '/_next/image*', static files and public pages matcher: [ '/((?!api|_next/static|_next/image|.*\\.png$|.*\\.webm$|(en|hr)/(!?policy|terms|login)).*)' ], }; // middleware will call NextAuth's `auth` method, which will in turn call) see `auth.ts` export default auth((req) => { // call the internalization middleware return(intlMiddleware(req)); });