Replies: 1 comment
-
same here, it is not clear |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have problem with client session, I need to reload manually reload page to get session, on server its okej.
After logging in, client component is not getting session data, only when reload it gets data.
NavBar1.tsx:
export async function Navbar1() {
const session = await auth()
console.log(JSON.stringify(session) + " from server")
return (
)
}
NavRoutes.tsx:
export function NavRoutes() {
const currentPath = usePathname();
const {data, update} = useSession();
const isActive = (path: string) => {
return currentPath === path;
}
console.log(data)
return (
<Link href="/o-nama" className={isActive("/o-nama") ? "text-red-600" : "hover:text-red-600"}>O NAMA
<Link href="/kontakt" className={isActive("/kontakt") ? "text-red-600" : "hover:text-red-600"}>KONTAKT
<Link href="/prodavnica" className={isActive("/prodavnica") ? "text-red-600" : "hover:text-red-600"}>PRODAVNICA
{!!data ? <><Link href="/moj-nalog" className={isActive("/moj-nalog") ? "text-red-600" : "hover:text-red-600"}>MOJ NALOG
<Link href="/" className={"hover:text-red-600"} onClick={() => { signOut(); }}>ODJAVI SE </> : <Link href="/auth" className={isActive("/auth") ? "text-red-600" : "hover:text-red-600"}>PRIJAVI SE}
)
}
Beta Was this translation helpful? Give feedback.
All reactions