all repos — caroster @ e3dd820256e0c4ea2c317a33c8fc29f9a83f3711

[Octree] Group carpool to your event https://caroster.io

🐛 Fix redirection for confirmation link [skip ci]
Tim Izzo tim@octree.ch
Mon, 02 Sep 2024 16:52:18 +0200
commit

e3dd820256e0c4ea2c317a33c8fc29f9a83f3711

parent

af1cc163f83aa7a171a4b1ee8a4ce6b095d10660

1 files changed, 3 insertions(+), 4 deletions(-)

jump to
M frontend/pages/api/auth/email-confirmation.tsxfrontend/pages/api/auth/email-confirmation.tsx

@@ -1,7 +1,5 @@

import type {NextApiRequest, NextApiResponse} from 'next'; -const {STRAPI_URL = 'http://localhost:1337'} = process.env; - export default async function handler( req: NextApiRequest, res: NextApiResponse

@@ -10,9 +8,10 @@ const confirmation = req.query.confirmation;

try { const response = await fetch( - `${STRAPI_URL}/api/auth/email-confirmation?confirmation=${confirmation}` + `http://localhost:1337/api/auth/email-confirmation?confirmation=${confirmation}` ); - if (response.redirected) return res.redirect(302, response.url); + if (response.redirected) + return res.redirect(302, '/auth/login?confirmed=true'); const result = await response.json(); if (result.error) throw new Error(result.error.name); } catch (error) {