NextJs错误的重定向

时间:2020-09-11 14:45:14

标签: next.js

当我尝试在生产模式下进入连接或订阅页面时,在控制台中出现此错误,并且页面的URL也不是我在代码中设置的URL。在localhost中可以正常工作。

framework.79fb030ec3df0dc442a2.js:1 TypeError: Cannot read property 'nom' of null
at h (compte.js:1)
at Gi (framework.79fb030ec3df0dc442a2.js:1)
at ko (framework.79fb030ec3df0dc442a2.js:1)
at xu (framework.79fb030ec3df0dc442a2.js:1)
at wu (framework.79fb030ec3df0dc442a2.js:1)
at du (framework.79fb030ec3df0dc442a2.js:1)
at framework.79fb030ec3df0dc442a2.js:1
at t.unstable_runWithPriority (framework.79fb030ec3df0dc442a2.js:1)
at $l (framework.79fb030ec3df0dc442a2.js:1)
at Xl (framework.79fb030ec3df0dc442a2.js:1)

main-b8de2659c8e469d623b1.js:1 TypeError: Cannot read property 'nom' of null
at h (compte.js:1)
at Gi (framework.79fb030ec3df0dc442a2.js:1)
at ko (framework.79fb030ec3df0dc442a2.js:1)
at xu (framework.79fb030ec3df0dc442a2.js:1)
at wu (framework.79fb030ec3df0dc442a2.js:1)
at du (framework.79fb030ec3df0dc442a2.js:1)
at framework.79fb030ec3df0dc442a2.js:1
at t.unstable_runWithPriority (framework.79fb030ec3df0dc442a2.js:1)
at $l (framework.79fb030ec3df0dc442a2.js:1)
at Xl (framework.79fb030ec3df0dc442a2.js:1)

我了解我的用户尚未定义,因为没有人连接或订阅,但是问题是Next不会重定向到它应该的位置:

我的代码:

       <Link passHref href='/register'>
           <li>
             <a>S'inscrire</a>
           </li> 
        </Link> 
        <Link passHref href='/login'>
           <li>
             <a>Se connecter</a>
           </li>
         </Link>

每当我尝试单击生产中的那些链接之一时,它就会将我发送到/ compte。

屏幕截图: https://res.cloudinary.com/dzqfghzga/image/upload/v1599828198/xpbob6lwdz9ir3ozmiba.jpg

重现行为的步骤:

-转到“ https://sungym69.com/” -在导航栏中单击“ s'inscrir”或“ Se连接器” -看到错误

thx为您提供帮助

0 个答案:

没有答案