/*
 added dotted .middleware to skip the crashing of app

#### Concept of triggering authentication
#### When users goes to a route named /portal/
#### or something else cleaver
#### we check if the user is authenticated 

import { isValid } from 'beta/utils/auth';
import { NextRequest, NextResponse } from 'next/server';

export function middleware(request: NextRequest) {
  // If the user is authenticated, continue as normal
  const { cookies } = request;
  const token = cookies.get('token');

  const isAuthenticated = token?.value && isValid(token?.value);
  if (isAuthenticated) {
    return NextResponse.next();
  }

  // Redirect to login page if not authenticated
  return NextResponse.redirect(new URL('/smusmu', request.url));
}

export const config = {
  matcher: '/((?!portal))',
};
*/
