NOTE: You must delete your account in Firebase and then sign up again so your data can be created!
Client
Creates our user account data via POST /account when signing up a user
Added a new React context: DataContext
Similar to AuthContext - currently just stores GP
Fetches data via GET /account when user logs in
There was a bug where it was trying to fetch data before the account data was set up - should be fixed now
Cause: Firebase automatically logs in the user after signup - this triggered the data fetch but we had not set up the account data yet, resulting in 404.
Fix: In the DataContext fetching, we do not run the fetch when the page is /auth/signup or /auth/login - once the user is redirected to /tavern it fetches user data as expected
Added public env variable for API
Passed in as NEXT_PUBLIC_API during build
Your /client/.env.local should look like this:
NEXT_PUBLIC_API = "http://localhost:3000/api/v1"
Server
Added CORS rule to accept incoming requests from client origin
The API preview deployment was rejecting our client requests because of CORS
Added the cors package and configured Express to accept incoming requests from the client deployment - the URL is passed in as an env variable CLIENT_URL during build
I don't think you need to update your local .env - it seemed to still work for me locally without having the CLIENT_URL set. Probably because locally it's the same origin and CORS accepts it by default
NOTE: You must delete your account in Firebase and then sign up again so your data can be created!
Client
Creates our user account data via
POST /account
when signing up a userAdded a new React context:
DataContext
AuthContext
- currently just stores GPGET /account
when user logs inDataContext
fetching, we do not run the fetch when the page is/auth/signup
or/auth/login
- once the user is redirected to/tavern
it fetches user data as expectedAdded public env variable for API
NEXT_PUBLIC_API
during build/client/.env.local
should look like this:Server
Added CORS rule to accept incoming requests from client origin
cors
package and configured Express to accept incoming requests from the client deployment - the URL is passed in as an env variableCLIENT_URL
during build.env
- it seemed to still work for me locally without having theCLIENT_URL
set. Probably because locally it's the same origin and CORS accepts it by defaultPreview
https://github.com/Legend-Mama/legend-mama/assets/113942748/43f876ee-7d34-42e2-a697-a68b5253bca0