Created
November 26, 2024 17:18
-
-
Save bridgpal/1f8c99b136a364d089804fad9ddb4522 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import type { Context, Config } from "@netlify/edge-functions"; | |
export default async (request: Request, context: Context) => { | |
const FIRST_VISIT_COOKIE = "has-visited"; | |
const hasVisited = context.cookies.get(FIRST_VISIT_COOKIE); | |
if (!hasVisited) { | |
context.cookies.set({ | |
name: FIRST_VISIT_COOKIE, | |
value: "true", | |
path: "/", | |
}); | |
return new URL("/en/insights", request.url); | |
} | |
return new URL("/en/support/community", request.url); | |
} | |
export const config: Config = { | |
path: "/testing", | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment