diff --git a/src/api/__tests__/lists.spec.ts b/src/api/__tests__/lists.spec.ts index 0978488..4e3accf 100644 --- a/src/api/__tests__/lists.spec.ts +++ b/src/api/__tests__/lists.spec.ts @@ -101,7 +101,7 @@ describe('lists API', () => { } as unknown as Response) global.fetch = fetchMock - const result = await createListApi({ name: 'Groceries', user_ids: [] }) + const result = await createListApi({ name: 'Groceries' }) expect(fetchMock).toHaveBeenCalledWith( `${API_BASE_URL}/lists`, @@ -119,7 +119,7 @@ describe('lists API', () => { await expect(createListApi({ name: 'x' })).rejects.toThrow('Failed') }) - it('createListItemApi sends POST to /lists/item and returns the created item with its server id', async () => { + it('createListItemApi sends POST to /lists/items and returns the created item with its server id', async () => { const mockItem = { id: 'item-1', list_id: '', title: 'Milk', is_completed: false } const fetchMock = vi.fn().mockResolvedValueOnce({ ok: true, @@ -131,13 +131,13 @@ describe('lists API', () => { const result = await createListItemApi({ list_id: 'list-1', title: 'Milk' }) expect(fetchMock).toHaveBeenCalledWith( - `${API_BASE_URL}/lists/item`, + `${API_BASE_URL}/lists/items`, expect.objectContaining({ method: 'POST' }), ) expect(result).toEqual(mockItem) }) - it('updateListItemApi sends PUT to /lists/item', async () => { + it('updateListItemApi sends PUT to /lists/items', async () => { const fetchMock = vi.fn().mockResolvedValueOnce({ ok: true, status: 204, @@ -147,7 +147,7 @@ describe('lists API', () => { await updateListItemApi({ list_item_id: 'item-1', is_completed: true }) expect(fetchMock).toHaveBeenCalledWith( - `${API_BASE_URL}/lists/item`, + `${API_BASE_URL}/lists/items`, expect.objectContaining({ method: 'PUT' }), ) }) @@ -206,7 +206,7 @@ describe('lists API', () => { await expect(deleteListApi('list-1')).rejects.toThrow('List not found') }) - it('deleteListItemApi sends DELETE to /lists/item/{id}', async () => { + it('deleteListItemApi sends DELETE to /lists/items/{id}', async () => { const fetchMock = vi.fn().mockResolvedValueOnce({ ok: true, status: 204, @@ -216,7 +216,7 @@ describe('lists API', () => { await deleteListItemApi('item-1') expect(fetchMock).toHaveBeenCalledWith( - `${API_BASE_URL}/lists/item/item-1`, + `${API_BASE_URL}/lists/items/item-1`, expect.objectContaining({ method: 'DELETE' }), ) }) diff --git a/src/api/lists.ts b/src/api/lists.ts index e673a85..2451165 100644 --- a/src/api/lists.ts +++ b/src/api/lists.ts @@ -36,7 +36,7 @@ export async function getListItemsApi(listId: string): Promise { } export async function createListItemApi(payload: CreateListItemPayload): Promise { - const response = await apiClient.post('/lists/item', payload) + const response = await apiClient.post('/lists/items', payload) if (!response.ok) { throw new Error(await extractErrorMessage(response, 'Failed to create list item')) } @@ -44,7 +44,7 @@ export async function createListItemApi(payload: CreateListItemPayload): Promise } export async function updateListItemApi(payload: UpdateListItemPayload): Promise { - const response = await apiClient.put('/lists/item', payload) + const response = await apiClient.put('/lists/items', payload) if (!response.ok) { throw new Error(await extractErrorMessage(response, 'Failed to update list item')) } @@ -82,7 +82,7 @@ export async function deleteListApi(listId: string): Promise { } export async function deleteListItemApi(itemId: string): Promise { - const response = await apiClient.delete(`/lists/item/${itemId}`) + const response = await apiClient.delete(`/lists/items/${itemId}`) if (!response.ok) { throw new Error(await extractErrorMessage(response, 'Failed to delete list item')) } diff --git a/src/components/InvitesPanel.vue b/src/components/InvitesPanel.vue index c899ed6..395797c 100644 --- a/src/components/InvitesPanel.vue +++ b/src/components/InvitesPanel.vue @@ -138,7 +138,11 @@ async function shareInvite(invite: Invite) { if (typeof navigator.share === 'function') { try { - await navigator.share({ title: 'Join dttmr', text: 'Use this link to create your account', url }) + await navigator.share({ + title: 'Join dttmr', + text: 'Use this link to create your account', + url, + }) return } catch (err) { if (err instanceof Error && err.name === 'AbortError') { @@ -248,7 +252,15 @@ function inviteDetail(invite: Invite): string { {{ inviteDetail(invite) }}
-