🐛 Fix redirection for confirmation link [skip ci]
        Tim Izzo tim@octree.ch
        
        
        
        
        
        Mon, 02 Sep 2024 16:52:18 +0200
        
          1 files changed,
          3 insertions(+),
          4 deletions(-)
          
          
        
            
            
            
            M
            
          
          frontend/pages/api/auth/email-confirmation.tsx
          
            → 
            frontend/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) {