This pull request introduces the referral invite functionality and makes several enhancements to the authentication flow in our Next.js application. The main changes include:
Referral Invite:
Added support for preserving the invite_id during the OAuth flow with Google and Facebook.
Modified the userStore.ts file to use atomWithStorage from Jotai for persisting the invite_id in localStorage.
Updated the AuthClient component to access and update the inviteIdAtom using the useAtom hook.
Modified the useUserData hook to access the inviteIdAtom using the useAtomValue hook.
Updated the handlePostSignIn function to pass the inviteId from the Jotai state.
Implemented expiration mechanism for the invite_id in localStorage, with a default expiration time of 5 hours.
Added logic to remove the invite_id from localStorage when the user logs out.
Authentication Flow:
Created a new register/page.tsx file to handle user registration.
Modified the login/page.tsx file to update the authentication layout.
Updated the AuthClient component to handle user registration and login flows.
Enhanced the useUserData hook to fetch user data whenever the amplify_id changes.
Improved error handling and user feedback during authentication processes.
Backend Configuration:
Modified the amplify/backend/auth/athletifiAuth/cli-inputs.json file to update the authentication configuration in the Amplify backend.
Code Optimization:
Refactored the useUserData hook to improve code readability and maintainability.
Optimized the logic for updating user data and notification preferences.
Fixed merge conflicts in the userStore.ts file.
These changes significantly enhance the authentication experience for users by introducing referral invite functionality and streamlining the registration and login processes. The referral invite feature allows users to join the platform through personalized invitation links, while the improved authentication flow provides a smooth and intuitive user experience.
Please review the code changes carefully, and let me know if you have any questions or suggestions for further improvements.
This pull request introduces the referral invite functionality and makes several enhancements to the authentication flow in our Next.js application. The main changes include:
Referral Invite:
Added support for preserving the
invite_id
during the OAuth flow with Google and Facebook.Modified the
userStore.ts
file to useatomWithStorage
from Jotai for persisting theinvite_id
in localStorage.Updated the
AuthClient
component to access and update theinviteIdAtom
using theuseAtom
hook.Modified the
useUserData
hook to access theinviteIdAtom
using theuseAtomValue
hook.Updated the
handlePostSignIn
function to pass theinviteId
from the Jotai state.Implemented expiration mechanism for the
invite_id
in localStorage, with a default expiration time of 5 hours.Added logic to remove the
invite_id
from localStorage when the user logs out.Authentication Flow:
Created a new
register/page.tsx
file to handle user registration.Modified the
login/page.tsx
file to update the authentication layout.Updated the
AuthClient
component to handle user registration and login flows.Enhanced the
useUserData
hook to fetch user data whenever theamplify_id
changes.Improved error handling and user feedback during authentication processes.
Backend Configuration:
amplify/backend/auth/athletifiAuth/cli-inputs.json
file to update the authentication configuration in the Amplify backend.Code Optimization:
Refactored the
useUserData
hook to improve code readability and maintainability.Optimized the logic for updating user data and notification preferences.
Fixed merge conflicts in the
userStore.ts
file.These changes significantly enhance the authentication experience for users by introducing referral invite functionality and streamlining the registration and login processes. The referral invite feature allows users to join the platform through personalized invitation links, while the improved authentication flow provides a smooth and intuitive user experience.
Please review the code changes carefully, and let me know if you have any questions or suggestions for further improvements.