prevent content blink

is there a way to prevent content blinking from user if not logged in
10 Replies
arete
areteOP2y ago
thanks in advance
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
arete
areteOP2y ago
arete
areteOP2y ago
something like that so the user willbe redirected with if not logged
FluX
FluX2y ago
Below your router.push() you could add another return statement and return for example a loader, if the user is not logged in. Besides server rendering the page, this is the only way I know
arete
areteOP2y ago
export async function getServerSideProps(ctx: GetServerSidePropsContext) { const session = await getServerAuthSession(ctx); if (session) { if (session.user?.role === "ADMIN") { return { redirect: { destination: "/admin", permanent: false, }, }; } if (session.user?.role === "MANAGER") { return { redirect: { destination: "/manager", permanent: false, }, }; } if (session.user?.role === "CASHIER") { return { redirect: { destination: "/cashier", permanent: false, }, }; } } return { props: { session, }, }; } i manage to do that with this code above
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
arete
areteOP2y ago
Ahhh This is exactly what I need thanks but how do i authorization? sadly it can only be use by jwt strategy
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
arete
areteOP2y ago
i use the db session that comes from ct3a template and idk really know how to setup the jwt
Want results from more Discord servers?
Add your server