Open louh opened 11 years ago
@louh absolutely. I think we should cache a session id on the client side, and store all relevant information on the server. We can temporarily cache any information they enter on the client side as well, but I'd rather it was persisted into a database of sorts.
How do I generate a sessionID?
I'm going to continue storing information in localStorage for the time being, because (a) I'm at a point where remembering data across reloads/refreshes will help me test the UI and (b) the logic for checking and loading previous sessions will likely be similar regardless of where it's actually being stored. As with others, let me know when an endpoint for session storage will be available and let's figure out how to interact with it.
The server will generate an ID the first time the record is persisted to the database. As soon as the first item of information is entered, you'll send a request with that data (if an ID doesn't already exist in their local storage), and I'll return the same information including an ID.
@rclosner
Here is some documentation on how I would interact with server-side models via Angular: http://docs.angularjs.org/api/ngResource.$resource
Would it be a good idea to rely on the server-side as canonical session storage? This way, the front end could read/write from it at will, and LocalStorage can be used to remember a session but not necessarily all of the data.