Last active
August 19, 2022 01:28
-
-
Save neilkillen/13fbc852dc25eb0334a6ecaf471dad67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
** Middleware Function to rewrite shops url based on user information stored in Sitecore Personalize | |
* @param req | |
* @returns NextResponse with a rewrite set | |
*/ | |
export function middleware(req: NextRequest){ | |
// Check if request is seasonal content and handle request to personalize experience | |
if(req.nextUrl.pathname.startsWith("/seasonal")) | |
{ | |
return handleSeasonalRequest(req) | |
} | |
// Check if request is store content and handle request to personalize experience | |
if(req.nextUrl.pathname.startsWith("/store")) | |
{ | |
return handleStoreRequest(req) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment