mirror of
https://github.com/vercel/commerce.git
synced 2025-05-12 12:47:50 +00:00
16 lines
481 B
TypeScript
16 lines
481 B
TypeScript
import { getOrigin, isLoggedIn } from 'lib/shopify/auth';
|
|
import type { NextRequest } from 'next/server';
|
|
|
|
// This function can be marked `async` if using `await` inside
|
|
export async function middleware(request: NextRequest) {
|
|
if (request.nextUrl.pathname.startsWith('/account')) {
|
|
console.log('Running Account middleware');
|
|
const origin = getOrigin(request);
|
|
return await isLoggedIn(request, origin);
|
|
}
|
|
}
|
|
|
|
export const config = {
|
|
matcher: ['/account/:path*']
|
|
};
|