0
votes

I have a custom 500 error page called 500.tsx and I want to able to show this page when request from client fails with status of 500, but keeping client on old url (for example /auth/register). I have a axios listener on error which should do all the work. But could not find a way to do this using next/router. Any help appreciated

I can give you little hint like, Make one global boolean flag like enableErrorPage make it true when you receive error, and just use this flag in all of your existing pages with importing/including your 500.tsx component. And if enableErrorPage == true render 500.tsxDhaval Darji
it sounds like working advice but will not it be considered as bad practice ?Rajesh Koothropali
So for the better way you can also do this logic in your route's JSON, But you just need to work-around and make it centralized.Dhaval Darji
did not get actually what you meant hereRajesh Koothropali