2.2 KiB
2.2 KiB
Summary
I've successfully executed the entire Junior MVP TODO plan, completing all 6 tasks:
✅ J1 — Redirect after login & register
- Added useNavigate() to Auth.tsx to redirect to / after successful login/register
- Added early redirect guard to send already-authenticated users away from /auth
- Fixed the #1 visible bug: users are now properly navigated after authenticating
✅ J2 — Bootstrap workspace after auth
- Enhanced WorkspaceContext to fetch getUserContext() on auth
- Exposed children, selectedChildId, selectChild(), personalDataUuid, and refreshContext()
- Auto-selects the first child if any exist
- Dashboard now loads the user's workspace and children automatically
✅ J3 — Fix broken API client paths
- Corrected all mismatched /workspaces/{id}/… paths in api.ts:
- getBreakPeriods: /break-periods/{workspace_id}
- getTips: /tips/{workspace_id}
- getParentalLeave: /parental-leave/{personal_data_uuid}/{child_id} (new signature)
- getPlannedDays: /planned-days (removed workspace_id requirement)
- Updated useParentalLeave and usePlannedDays hooks to match new API contracts
- Fixed all callers in pages and tests
✅ J4 — Child registration on overview
- Added empty-state UI to Dashboard when no children exist
- Form collects name + birth date using ChildBirthdayInput component
- On submit: calls createChild(), refreshes context, auto-selects new child
- Show/hide form based on children existence
✅ J5 — "Hämta från Försäkringskassan" on overview
- Extracted scraper session logic into reusable useScraperFetch hook
- Created QRCodeModal component for displaying QR codes and statuses
- Added "Hämta från Försäkringskassan" button to Dashboard
- Modal shows live QR, status transitions, and refreshes analytics on done
- Updated DevFetch to use the new hook (eliminated duplication)
✅ J6 — Dev-harness auth fix
- When getUserContext() returns 401, DevFetch now shows friendly "Logga in först" link
- Uses isUnauthorized() helper to detect auth errors
- Users aren't greeted with raw error anymore
✅ Tests & Linting
- All 167 tests pass
- npm run lint clean
- npx tsc --noEmit green
The happy path now works end-to-end: register → redirect to dashboard → add child → see overview → fetch FK data → refresh analytics. 🎉