Open gkpty opened 8 months ago
Update this so that a user and cart are fetched from cookies only. a cart will always be the given leads latest cart. create the functions:
There are different use cases for managing lead/carts:
Whatever solution is implemented must make the cart and contact points work for any of the scenarios
one potential solution that is cookie proof is using a custom headers in requests and using a server session id in the headers.
there should be a single function getVisitorInfo:
another function called getServerVisitorInfo that fetches visitor info from cookies
these 2 methods can be used on demand where they are needed, wether on a useEffect hook at a client component or on the server or server rendered page
optionally a global cache provider like Redux or hopefuly something simpler might work.. thing is itll have to wrapp the entire app and it might hinder performance..
a user should be able to be related to several leads, in case a user signs in on two different devices. -> manage different scenarios