Redirect issue in getServerSideProps
Answered
Ruwbix posted this in #help-forum
RuwbixOP
Hi I have the following code in getServerSideProps:
however, it does not seem to redirect correctly, instead it just redirects to /error.
if (!params?.destination || typeof params.destination !== 'string') {
// Handle invalid or missing destination
return {
redirect: {
destination: '/test',
permanent: false,
},
};
}
however, it does not seem to redirect correctly, instead it just redirects to /error.
1 Reply
I have been using redirect as
Try this!
redirect("/test")
Try this!
Answer