realworld icon indicating copy to clipboard operation
realworld copied to clipboard

Session does not perssists after refresh

Open codewithpatelo opened this issue 4 years ago • 6 comments

I noticed that this code does not prevent sessions to be lost after a page refresh. Should it work that way?

codewithpatelo avatar Jul 30 '20 17:07 codewithpatelo

@codewithpatelo, use express-session and store session. it will keep session!

capripio avatar Aug 15 '20 13:08 capripio

Any chance you can point in the right direction? I seem to struggle to find a working solution

n1ghtie avatar Oct 18 '20 08:10 n1ghtie

The "user" object gets nested on page refresh, its there it just gets undefined due to nesting. In your " login/index.svelte " change lines 26 - 29 to be if (response.token) { $session.user = response; goto('/'); } and in " auth/login.js " change the user object to be if (response.user) req.session.user = {"id": 1234, "email": "[email protected]", "username": "test", "token": "tesssttttt", "bio":null, "image": null}

nousacademy avatar Oct 20 '20 01:10 nousacademy

A more actively maintained version now lives at https://github.com/sveltejs/kit/tree/master/examples/realworld.svelte.dev

benmccann avatar Mar 25 '21 16:03 benmccann

A more actively maintained version now lives at https://github.com/sveltejs/kit/tree/master/examples/realworld.svelte.dev

Gives 404

bcodus avatar Nov 17 '21 12:11 bcodus

The realworld team would not list projects in a monorepo, so we moved it back here

benmccann avatar Nov 17 '21 14:11 benmccann

closing as out of date

Rich-Harris avatar Nov 04 '22 16:11 Rich-Harris