feat: user api integration + sign in / sign up flow fix#145
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
custom: Applied vercel-react-best-practices.
This PR migrates user profile data from Firebase callables to the new user-service REST API, centralizes post-auth redirect logic across sign-in/sign-up/verify-email/complete-registration screens, and adds UI + E2E coverage for editing user profiles and the full registration flow.
Changes:
- Add user-service OpenAPI schema + generated types and integrate
/v1/userGET/PUT into the profile service. - Introduce a shared
useRegistrationFlowRedirecthook and update auth/registration pages to use it. - Add account profile editing (save flow + UI loading/toast feedback) and expand Cypress E2E coverage for sign-in, sign-up flow, and account editing.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/app/types.ts | Adds action type constant for saving user profile. |
| src/app/store/saga/profile-saga.ts | Adds saga to persist profile edits via the user-service API. |
| src/app/store/saga/auth-saga.ts | Enhances sign-up flow to fetch user-service profile data after Firebase sign-up. |
| src/app/store/profile-selectors.ts | Adds selector for save-user-profile status. |
| src/app/store/profile-reducer.ts | Adds reducers/state for profile save lifecycle (loading/success/fail/reset). |
| src/app/services/user-service-api-types.ts | Adds generated OpenAPI types for the user-service API. |
| src/app/services/profile-service.ts | Replaces Firebase callable profile read/write with /v1/user GET/PUT. |
| src/app/hooks/useRegistrationFlowRedirect.ts | New centralized redirect logic for the multi-step registration flow. |
| src/app/hooks/index.ts | Re-exports the new registration redirect hook. |
| src/app/[locale]/verify-email/PostRegistration.tsx | Uses the new redirect hook instead of per-page redirect effect. |
| src/app/[locale]/verify-email/page.tsx | Temporarily removes auth/status wrapper around verify-email page. |
| src/app/[locale]/sign-up/SignUp.tsx | Uses shared redirect hook; removes duplicated redirect effect. |
| src/app/[locale]/sign-in/SignIn.tsx | Uses shared redirect hook; removes duplicated redirect effect. |
| src/app/[locale]/complete-registration/page.tsx | Temporarily removes auth/status wrapper around complete-registration page. |
| src/app/[locale]/complete-registration/CompleteRegistration.tsx | Uses shared redirect hook; removes duplicated redirect effect. |
| src/app/[locale]/account/AccountSectionContainer.tsx | Adds optional loading indicator to account section container. |
| src/app/[locale]/account/AccountGeneral.tsx | Adds profile edit/save UI, status toasts, and dispatches save actions. |
| package.json | Adds scripts to generate user-service API types from OpenAPI YAML. |
| external_types/UserServiceAPI.yaml | Adds user-service OpenAPI spec (profile + notifications/subscriptions). |
| external_types/BearerTokenSchema.yaml | Adds shared bearer auth schema referenced by the user-service spec. |
| cypress/support/index.ts | Declares new Cypress command for Firebase-only user creation. |
| cypress/support/commands.ts | Implements createNewFirebaseUser helper for E2E flows controlling Redux directly. |
| cypress/e2e/signup.cy.ts | Adds E2E coverage for full verify-email → complete-registration → redirect flow. |
| cypress/e2e/signin.cy.ts | Adds E2E coverage for post-login redirect behaviors. |
| cypress/e2e/accountGeneral.cy.ts | Adds E2E coverage for account profile editing and error flows. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
*Lighthouse ran on https://mobilitydatabase-330zywy8m-mobility-data.vercel.app/ * (Desktop)
*Lighthouse ran on https://mobilitydatabase-330zywy8m-mobility-data.vercel.app/feeds * (Desktop)
*Lighthouse ran on https://mobilitydatabase-330zywy8m-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
*Lighthouse ran on https://mobilitydatabase-330zywy8m-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
*Lighthouse ran on https://mobilitydatabase-330zywy8m-mobility-data.vercel.app/feeds/gbfs/gbfs-flamingo_porirua * (Desktop)
|
| sx={{ mt: 1 }} | ||
| > | ||
| Change Password | ||
| {t('changePassword')} |
davidgamez
left a comment
There was a problem hiding this comment.
LGTM!
I'll leave it to @emmambd to review the UX flow
| <ProtectedPageWrapper targetStatus='unverified'> | ||
| <PostRegistration /> | ||
| </ProtectedPageWrapper> | ||
| {/* TODO: Revisit protected page wrappers. This page changes the status of the user which causes flickers of mismatched authentication */} |
There was a problem hiding this comment.
👍 Let's create an issue to be able to follow-up
|
Tested subscribing to notifications and going to the contribute page signed out - both flows worked. I could edit my name, my organization, and my email consent without issue. LGTM! |
closes #139
Summary:
Expected behavior:
Testing tips:
Login / Signup
Account
Follow up tickets
verify-emailandcomplete-registrationPlease make sure these boxes are checked before submitting your pull request - thanks!
yarn testto make sure you didn't break anything