gioboa / qwik-dream-demo

https://qwik-dream-demo.pages.dev/
28 stars 11 forks source link

Connect to Vendure backend #21

Closed michaelbromley closed 2 years ago

michaelbromley commented 2 years ago

This PR makes the following changes:

  1. Replaces mock data calls in the Product, Menu & Cart MFEs with calls to the Vendure readonly demo API instance
  2. Defines a set of custom events which are used to communicated state changes across MFE boundaries
  3. Makes uses of browser localstorage to store the Vendure session token. This means that cart state is persisted even after page refreshes.

The event system is still crude & untyped, and in a real app we would want to wrap this into some kind of type-safe MFE state management solution I guess. For this demo it works fine though.

1 thing I did not do is to make the cart contents server-rendered. I'm not sure how to do this at the moment as it would involve the server knowing the vendure session token somehow.

gioboa commented 2 years ago

Close #13

gioboa commented 2 years ago

Close #18