How to redirect from login page with trpc's SSR enabled?

Any simple solutions for redirecting unauthenticated users to /login and authenticated users from /login to / with trpc's SSR enabled, i.e., without the use of getServerSideProps?
2 Replies
whatplan
whatplan2y ago
Is this what your looking for?
const session = useSession()
const router = useRouter()
if (!session) {
router.push("/login")
}
const session = useSession()
const router = useRouter()
if (!session) {
router.push("/login")
}
mmurto
mmurto2y ago
Thanks, that's probably it!
Want results from more Discord servers?
Add your server