⚡ Adds api
This commit is contained in:
@@ -10,21 +10,16 @@ The plan is derived from:
|
||||
- Build scripts in `bs/` – only linting is required at this stage.
|
||||
|
||||
## Tasks
|
||||
1. **Environment handling** (TODO)
|
||||
- Create a small helper (`@core/env.ts`) that reads `.env.ts` (or falls back to process.env).
|
||||
- Expose constants: `COMMAFEED_URL`, `USERNAME`, `PASSWORD`.
|
||||
1. **API client** (TODO)
|
||||
1. **API client** (DONE)
|
||||
- Adds `src/api` folder to the project structure (update also @src/README.md).
|
||||
- Implement a lightweight wrapper around `fetch` in `src/api/index.ts`.
|
||||
- Build `authHeader()` that returns the Basic‑Auth header using env vars.
|
||||
1. **Episode service** (TODO)
|
||||
- Implement a lightweight wrapper around `fetch` in `src/api/fetchAPI.ts`.
|
||||
- Build `authHeader()` that returns the Basic‑Auth header using for now hardcoded vars.
|
||||
1. **Episode service** (DONE)
|
||||
- Add `src/api/episodes.ts` with `getEpisodes(feedId)` and `getEpisode(id)`.
|
||||
- Add data types
|
||||
- Use `/rest/feed/entries?feed_id=${feedId}` endpoint.
|
||||
1. **Route integration** (TODO)
|
||||
- In `app-episodes/routes.ts`, call the service during `enter()` to pre‑fetch episodes.
|
||||
- Pass fetched data via route context or set a global state (e.g., using Lit Labs signals).
|
||||
1. **Page update** (TODO)
|
||||
- Add fetching all episodes
|
||||
- Update `<app-episodes>` to reflect loading state(s).
|
||||
- Add episode list item component.
|
||||
- Update `<app-episodes>` to render the episode list received from the route context.
|
||||
|
||||
Reference in New Issue
Block a user