Hi, how can I redirect to a page on login that has...
# help
s
Hi, how can I redirect to a page on login that has a
withPageAuth()
set? That is, I'd like a user who logs in to go to the
/home
page but
/home
has a
withPageAuth()
requirement from
supabase-auth-helpers
and the redirect doesn't succeed
n
Hello @sbr! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
s
@thorwebdev should I change withPageAuth() in any way to handle this?
t
@sbr have you looked at how the nextjs-subscription-payments starter does it? Maybe that works for you too? I’m not entirely sure what exactly the problem is you’re outlining and only on phone but if you send more details I can check later.
n
sbr (2022-05-21)
s
Thank you @thorwebdev! I'll check out nextjs-subscription-payments
@thorwebdev
nextjs-subscription-payments
redirects to the default page on login and not the
/account
page which is gated by auth. The default page has a
useEffect
https://github.com/vercel/nextjs-subscription-payments/blob/main/pages/signin.tsx#L58-L62 that waits for the user object to change and then does a
router.push
to the account page. But I think this is inefficient since the user sees the default page for a few seconds before being redirected to the account page
Do you know of a way to prevent the wait in the default page?
@thorwebdev friendly ping in case you figured out a solution!