You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.3 KiB
2.3 KiB
| title | status | type | priority | created_at | updated_at | blocked_by | |
|---|---|---|---|---|---|---|---|
| Implement API client module — typed fetch wrappers for all quotesdb-api endpoints | completed | task | high | 2026-03-10T23:32:06Z | 2026-03-10T23:32:13Z |
|
The API client module provides typed fetch wrappers around all quotesdb-api endpoints. The UI calls these functions from page components rather than making raw fetch calls directly.
Implement `src/bin/ui/api.rs` (or `src/bin/ui/client.rs`) with async functions for each endpoint: - `list_quotes(page, author, tag) -> Result` - `get_quote(id) -> Result` - `get_random_quote() -> Result` - `create_quote(body) -> Result` - `update_quote(id, auth_code, body) -> Result` - `delete_quote(id, auth_code) -> Result<()>`Each function sets the appropriate headers (including X-Auth-Code where needed) and deserialises the response.
- Use relative URLs (
/api/quotes,/api/quotes/random, etc.) — no base URL configuration needed. - In local dev, Trunk's
[[proxy]]inTrunk.tomlforwards/api/*tolocalhost:3000transparently. - In production, Cloudflare routes
/api/*to the Worker at the same domain. - Do NOT use
window.location.originas a base URL — relative paths work everywhere. - Do NOT add any CORS headers in the frontend — no cross-origin requests occur.
trunk build
`feat(quotesdb): implement typed API client module for all quotesdb-api endpoints`