I tried setting the username and then reading it in a session in the client side in the following code but it gives an error:
import { useSession } from "vinxi/http";
function getSession() {
return useSession({
password: process.env.SESSION_SECRET
});
}
export default function Index() {
const session = getSession();
session.data.user = "adam"; //set the user name
const username : string = session.data.user //get the user name
return (
<div>
<p>Username: {username}</p>
</div>
);
}