Takes you back to referer page on v2 opt-in

pull/4222/head
zomars 2022-09-06 19:18:47 -06:00
parent 13c2dc24dc
commit 2027447eab
1 changed files with 6 additions and 1 deletions

View File

@ -15,7 +15,12 @@ async function handler(req: NextApiRequest, res: NextApiResponse<Response>): Pro
res.setHeader("Set-Cookie", "calcom-v2-early-access=1; Path=/");
}
res.redirect("/");
let redirectUrl = "/";
// We take you back where you came from if possible
if (typeof req.headers["referer"] === "string") redirectUrl = req.headers["referer"];
res.redirect(redirectUrl);
}
export default defaultHandler({