Connect the student app to the Rezina API #5

Merged
naol-yaltopia merged 4 commits from api-integration into main 2026-11-03 16:57:59 +03:00

4 Commits

Author SHA1 Message Date
26d518b631 Merge branch 'main' into api-integration 2026-11-03 16:57:11 +03:00
ff5772e9cf build: Vercel builds against the real API by default
- new `app:build` script bakes NEXT_PUBLIC_LMS_API=https://api.rezina.yaltopia.com into
  the student app; the URL lives in package.json, so nobody sets it by hand
- vercel.json runs `app:build`, so a deploy of this branch talks to the API with no
  dashboard settings
- `demo:build` (the hosted artifact demo) is unchanged and keeps demo data: its sandbox
  blocks calls to outside servers (artifact check: no network attempts)
- README: Vercel section updated, including how to build the old in-memory demo
2026-11-02 20:53:55 +03:00
d92180542b fix(api): time out and retry when the API server drops connections
About a third of new connections to api.rezina.yaltopia.com never complete (the TCP
connect hangs; requests that do connect answer in ~0.5s). With no timeout, sign-in sat
on a busy button forever.

- every API call gives up after 12s
- calls that are safe to repeat retry twice: reads, the account lookup, password login;
  sending or verifying a code never retries, so nobody gets two texts or burns a code
- the catalog keeps at most 3 requests in flight instead of firing one per course at once
- sign-in shows "Couldn't reach the server. Check your connection and try again."
  (auth.networkError, om/ti drafts) instead of hanging
2026-11-02 19:29:37 +03:00
8ba936baae feat(api): connect the student app to the Rezina API
ApiDataSource maps the Go API onto the existing DataSource, so the screens are unchanged.
Build with NEXT_PUBLIC_LMS_API=https://api.rezina.yaltopia.com to use it; without it the
demo keeps its own data.

Verified against the live API (public, no sign-in):
- catalog and course outlines: courses, chapters, lessons, lesson notes, covers
- FREE lessons (and every lesson of a FREE course) play for anyone; a free course offers
  "Start lesson 1" instead of a disabled buy button

Built from the spec, not yet tested with a real account:
- sign-in: phone code (login or register) and email + password, token refresh, sign-out
- profile, progress summary (owned courses, completed lessons), lesson video URLs
- video heartbeat, notifications (list, read/unread), issue reports, profile updates

Not on the API yet, so left on hold: per-course prices and purchases (buying shows the
"not connected" message), translations, categories, teacher, durations, prerequisites,
chapter quizzes, Google/Apple sign-in.

Screens now hide what a course doesn't have instead of showing it empty: category pill,
teacher line and creator row, "0 min" durations, an empty card footer. Lessons with a
Vimeo link play that video; the sample clip and "mark as watched" stay for lessons
without one.

Mapping checks (packages/data/src/api.check.ts) run in `pnpm test` against saved live
responses.
2026-11-02 14:23:47 +03:00