feat(fe): implement authentication and user profile management
Description
Implement the Authentication & User Profile flow on the frontend application, adhering to the Claymorphism design guidelines and integrating seamlessly with the backend APIs.
Key Changes
-
Dependencies: Added
axios,zustand,@tanstack/react-query,zod,react-hook-form, and@hookform/resolvers. -
API Client & interceptor (
src/lib/api-client.ts): Configured Axios withwithCredentials: trueand added response interceptors to handle token refresh automatically via HttpOnly cookies upon receiving a401 Unauthorizedresponse. -
State Store (
src/stores/auth-store.ts): Created a Zustand global store to handle user authentication state (user,isAuthenticated, and initialization flags). -
Guarded Navigation: Developed
AuthGuard(src/components/shared/AuthGuard.tsx) to protect private screens and updatedsrc/components/layout.tsxto handle initial authentication checks on app boot. -
Input Refactoring: Refactored the core
Inputcomponent to supportReact.forwardReffor seamless validation registration withreact-hook-form. -
Claymorphism Screens: Created the following screens styled with dual-tone soft shadows and chunky borders:
-
Login / Register: Handles validation (such as enforcing
@gmail.comvalidation). - Forgot / Reset Password: Requests and verifies UUID password reset tokens.
-
User Profile & Sessions: Handles updating personal details, changing passwords, and listing/revoking active devices sessions (via
/auth/sessions).
-
Login / Register: Handles validation (such as enforcing