diff --git a/frontend-spec.md b/frontend-spec.md index 46d719d..ef93967 100644 --- a/frontend-spec.md +++ b/frontend-spec.md @@ -165,6 +165,7 @@ Progress Log (Nov 1, 2025) - Added `useAuth.createAccount` with state update and tests for it; implemented `CreateAccount.vue` with form and navigation. - Implemented Invitation Accept flow: added `src/api/invitations.ts` with `acceptInvitation` (temporary raw fetch), `InvitationAccept.vue` reads token and redirects to household; added `tests/invitations.api.test.ts`. - Next: Implement Household Settings (invite members form), then remove legacy Person UI. + - Added a Settings link to `HouseholdSwitcher.vue` to surface the `household-settings` route for easier discovery. --- diff --git a/src/api/households.ts b/src/api/households.ts new file mode 100644 index 0000000..8ba1412 --- /dev/null +++ b/src/api/households.ts @@ -0,0 +1,18 @@ +import { api, fetchApi } from '@/api/client' +import type { components, paths } from '@/api/types' + +export type Member = components['schemas']['User'] + +// Prefer typed endpoint if exists, fallback to raw fetch for now +export async function listMembers(): Promise { + // Try typed path if openapi exposes it + const hasTyped: boolean = Boolean((api as unknown as { GET?: unknown }).GET) + if (hasTyped) { + // Our OpenAPI file doesn't specify this route yet, so default to raw fetch + } + const resp = await fetchApi('/api/v1/households/members', { method: 'GET' }) + if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText || 'HTTP error'}`) + const data = await resp.json().catch(() => null) + const arr = Array.isArray(data) ? data : [] + return arr.filter((m): m is Member => typeof m === 'object' && m !== null && typeof (m as { id: unknown }).id === 'number') +} diff --git a/src/views/HouseholdSettings.vue b/src/views/HouseholdSettings.vue index 5448d39..81cbc68 100644 --- a/src/views/HouseholdSettings.vue +++ b/src/views/HouseholdSettings.vue @@ -35,7 +35,18 @@

Current members

-

+

+

Listing members will be added once the backend endpoint is available.

@@ -43,13 +54,23 @@