Clarify public catalog integration for customer apps
This commit is contained in:
parent
aa718ae7d0
commit
c4892d42e8
|
|
@ -2,9 +2,12 @@
|
|||
|
||||
## Browse without signing in
|
||||
|
||||
The web app exposes `/catalog` and `/catalog/courses/:id` outside the authenticated
|
||||
admin layout. Visitors to `/` see the catalog; signed-in staff retain their usual
|
||||
dashboard redirect. The staff login page also links to the catalog.
|
||||
Public discovery is intended for customer-facing web and mobile learning apps.
|
||||
The admin panel is a staff application: signed-out visitors to `/` are redirected
|
||||
to `/login`, and signed-in staff go to their role's default management page.
|
||||
The admin panel does not host customer catalog pages or use anonymous catalog APIs
|
||||
for content management. Its course, chapter, lesson, and quiz tools continue to
|
||||
use authenticated `/api/v1/admin` endpoints.
|
||||
|
||||
Anonymous APIs:
|
||||
|
||||
|
|
@ -21,11 +24,26 @@ question delivery, and completion remain behind the existing learning endpoints
|
|||
and their authentication/subscription rules. Previewing a premium lesson does not
|
||||
grant access to it.
|
||||
|
||||
The web app uses `VITE_API_BASE_URL` with a trailing `/admin` removed for catalog
|
||||
requests. Requests omit cookies and staff authorization. Optionally set
|
||||
`VITE_LEARNER_APP_URL` to your customer web/mobile sign-in destination to display
|
||||
a **Sign in to learn** link. Without it, the page directs visitors to their
|
||||
learning app. The staff login continues to be labeled **Staff sign in**.
|
||||
### Client app integration
|
||||
|
||||
Use the backend's public API base (for example `https://api.example.com/api/v1`)
|
||||
in the customer app, without the `/admin` suffix. No bearer token is required.
|
||||
Render course highlights from the list response and load the course outline
|
||||
when a visitor selects a course. For browser requests, omit staff credentials:
|
||||
|
||||
```javascript
|
||||
const apiBase = "https://api.example.com/api/v1";
|
||||
const response = await fetch(`${apiBase}/catalog/courses?limit=20&offset=0`, {
|
||||
credentials: "omit",
|
||||
});
|
||||
if (!response.ok) throw new Error("Unable to load course highlights");
|
||||
const { data } = await response.json();
|
||||
// data.courses, data.total_count, data.limit, data.offset
|
||||
```
|
||||
|
||||
Use `GET /catalog/courses/{id}` on the same base for the published outline.
|
||||
Customer apps should offer their own learner sign-in flow when visitors choose
|
||||
to start learning; authenticated playback, quiz, and progress APIs enforce access.
|
||||
|
||||
## Install the demo fixture
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user