Adds api

This commit is contained in:
2026-06-11 15:03:28 +02:00
parent c000517fd1
commit 97983aff87
4 changed files with 77 additions and 11 deletions
+5 -10
View File
@@ -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 BasicAuth header using env vars.
1. **Episode service** (TODO)
- Implement a lightweight wrapper around `fetch` in `src/api/fetchAPI.ts`.
- Build `authHeader()` that returns the BasicAuth 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 prefetch 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.