import type { NextApiRequest , NextApiResponse } from 'next' ; import { TEST_COOKIE_NAME } from "./index" ; import createTopLevelRedirect from "./create-top-level-redirect" ; import { setCookie } from "../helpers/cookies" ; export default function createEnableCookiesRedirect ( apiKey , path , appUrl ) { const redirect = createTopLevelRedirect ( apiKey , path , appUrl ) ; return function topLevelOAuthRedirect ( req , res ) { setCookie ( { res , name : TEST_COOKIE_NAME , value : "1" } ) ; redirect ( req , res ) ; } ; }