Using res.redirect with next v9.5.0 #15558
Answered
by
timneutkens
simonuvarov
asked this question in
Help
-
Hi, I've updated next to the latest version (9.5.0) and one of the new features was that now it support
I took examples from this commit. Even though those changes were undone later, I suppose that now, when this feature is released, it should work. My code: export const getServerSideProps = async context => {
const { req, res } = context;
const session = await getCurrentSession({ req });
if (session) {
res.redirect('/dashboard');
return;
}
return { props: {} };
}; What do I do wrong? Thanks, |
Beta Was this translation helpful? Give feedback.
Answered by
timneutkens
Jul 28, 2020
Replies: 1 comment 4 replies
-
These helpers are only available in API routes |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
simonuvarov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These helpers are only available in API routes