Expiration

πŸ‘¨β€πŸ’Ό For this app, we want the session to last 30 days, but only if the user checks "remember me." Otherwise, we want the session to last only until the user closes the browser.
Because of this, we can't configure our session storage object to have an expiration (you can configure the createCookieSessionStorage session storage object to have an expiration). Instead, we need to set the expiration when we commit the session in the login and signup routes.
🐨 To promote reusability, let's create a variable in called SESSION_EXPIRATION_TIME that's set to 30 days in milliseconds which is 1000 * 60 * 60 * 24 * 30. You can then make a getSessionExpirationDate which returns a new date that is Date.now() + SESSION_EXPIRATION_TIME.
Then we can use that in our login and signup routes to set the expiration time if the user has checked "remember me."
await sessionStorage.commitSession(cookieSession, {
	// Cookies with no expiration are cleared when the tab/window closes
	expires: remember ? getSessionExpirationDate() : undefined,
})
Go ahead and make those updates please.

Access Denied

You must login or register for the workshop to view the diff.

Check out this video to see how the diff tab works.