adverse-sapphire
adverse-sapphire•2y ago

nextjs router broken ?

Hi! I just started using refine. I added the necessary functions in the authProvider.ts, changed supabase keys. My selection is NextJS, Supabase, AntD and Typescript. If I click a link, I end up with /login?to=%2Fregister in the url, but no page change. I have this in my network tab: {"pageProps":{"__N_REDIRECT":"/login?to=%2Fforgot-password","__N_REDIRECT_STATUS":307},"__N_SSP":true} Is it something I'm missing or is this a bug ? Thanks
1 Reply
continuing-cyan
continuing-cyan•2y ago
Hey @istacknades, guessing from the /login?to=/register part, you're able to see the /login page but not the other ones, right? If so, its because refine handles the /login route by default and Auth Provider is including all other functions. You can create a custom page as /register and use <AuthPage type="register" />. (This part is up to you, we provide an AuthPage component in @pankod/refine-antd to get you handle your authentication process quickly but its optional to use) Here's the AuthPage docs from @pankod/refine-antd https://refine.dev/docs/api-reference/antd/components/antd-auth-page/ The code examples are written with react-router-v6 but it will give you an idea on how to use it. For next.js side, here's how to create a custom page (just create one 🤣 ) https://refine.dev/docs/advanced-tutorials/ssr/nextjs/#custom-page