Set up API client module #23

Open
opened 2026-03-16 22:41:54 +00:00 by austin · 0 comments
Owner

A typed, reusable API client that all pages will use to communicate with the backend.

What needs to happen

Create src/lib/api.ts — a thin wrapper around fetch. It should:

  • Set Content-Type: application/json on requests
  • Include credentials (cookies) for auth
  • Throw typed errors on non-2xx responses
  • Provide typed methods: api.projects.list(), api.projects.get(key), api.issues.list(projectKey, filters?), api.issues.create(projectKey, input), api.issues.update(projectKey, number, input)

Also configure the Vite dev server proxy in vite.config.ts:

  • /apihttp://localhost:8659
  • /authhttp://localhost:8659

This lets the frontend dev server and Go backend run independently during development.

Key files

  • web/src/lib/api.ts — new
  • web/vite.config.ts — add proxy config
A typed, reusable API client that all pages will use to communicate with the backend. ## What needs to happen Create `src/lib/api.ts` — a thin wrapper around `fetch`. It should: - Set `Content-Type: application/json` on requests - Include credentials (cookies) for auth - Throw typed errors on non-2xx responses - Provide typed methods: `api.projects.list()`, `api.projects.get(key)`, `api.issues.list(projectKey, filters?)`, `api.issues.create(projectKey, input)`, `api.issues.update(projectKey, number, input)` Also configure the Vite dev server proxy in `vite.config.ts`: - `/api` → `http://localhost:8659` - `/auth` → `http://localhost:8659` This lets the frontend dev server and Go backend run independently during development. ## Key files - `web/src/lib/api.ts` — new - `web/vite.config.ts` — add proxy config
austin self-assigned this 2026-03-16 22:41:54 +00:00
Sign in to join this conversation.
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
austin/vektor#23
No description provided.