I want to access cookies in the load function within +layout.js
. I want to be able to make my header/nav in the template show "login/signup" in the nav if there is not a jwt saved in cookies, but show "logout" if there is.
Below is my +layout.js
. I expect this to access cookies like it does in the exact same code in my +page.server.js
file. Instead, I get the error "Cannot read properties of undefined (reading 'get')"
export function load({ cookies }) { return { jwt: cookies.get("jwt") }}