imperfectandcompany / Imperfect-Gamers-Site-Store

Our robust community site integrating Steam for enhanced user interactions and data management, powered by Remix with Tailwind CSS for optimistic, responsive UI. Features CI/CD with GitHub Actions and Docker for seamless deployment and maintenance.
https://store.imperfectgamers.org/
Other
0 stars 0 forks source link

Improve Basket and Package Management on User Logout and Login #73

Open cheesea3 opened 1 month ago

cheesea3 commented 1 month ago

Currently, the application checks for existing cookies related to the basket, package, and checkout URL. If these cookies do not exist, the system uses the Tebex API to create the necessary items. This process has the following issues:

Enhancement:

  1. Clear Cookies on Logout:

    • Upon user logout, wipe all cookies related to the basket, package, and checkout URL.
    • Ensure that no basket, package, or checkout URL cookies exist when a user is logged out.
  2. Persist Cookies on Refresh:

    • If the user is still logged in and refreshes the page, the basket, package, and checkout URL cookies should persist.
    • Allow the user to continue with their checkout process without interruption.
  3. Fetch and Store Basket Details on Login:

    • When a user logs in, check the backend database for existing basket, package, and checkout URL details.
    • If no details are found in the database, use the Tebex API to acquire the necessary information.
    • Store the retrieved basket, package, and checkout URL details in the database.
    • Continue saving the session and setting the necessary cookies as currently implemented.
  4. Static Identifiers:

    • Maintain a static basket identifier for the user, along with static package and checkout URL identifiers.
    • Avoid generating new identifiers each time cookies are missing, supporting multi-account usage where each user maintains their own session.

Implementation Steps:

  1. Modify the logout functionality to clear all related cookies.
  2. Ensure cookies persist on page refresh while the user is logged in.
  3. Implement database checks and Tebex API calls upon user login to fetch and store basket details.
  4. Adjust the session and cookie management to use static identifiers from the database.

This enhancement aims to improve the overall user experience by providing consistent session management, supporting multi-account usage, and reducing unnecessary API calls.

Additional Notes: