From d00361c4ac62495fbd9b501e393c6a948a1c1fa4 Mon Sep 17 00:00:00 2001 From: Robin Dittmar Date: Fri, 21 Aug 2026 20:56:27 +0200 Subject: [PATCH] fix: use field "email" instead of "user_id" in /lists/user --- src/api/__tests__/lists.spec.ts | 4 ++-- src/stores/lists.ts | 12 ++++++------ src/types/list.ts | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/api/__tests__/lists.spec.ts b/src/api/__tests__/lists.spec.ts index c1e5c73..7dc4f50 100644 --- a/src/api/__tests__/lists.spec.ts +++ b/src/api/__tests__/lists.spec.ts @@ -157,7 +157,7 @@ describe('lists API', () => { } as unknown as Response) global.fetch = fetchMock - await addUserToListApi({ list_id: 'list-1', user_id: 'user-1' }) + await addUserToListApi({ list_id: 'list-1', email: 'user@example.com' }) expect(fetchMock).toHaveBeenCalledWith( `${API_BASE_URL}/lists/user`, @@ -172,7 +172,7 @@ describe('lists API', () => { } as unknown as Response) global.fetch = fetchMock - await removeUserFromListApi({ list_id: 'list-1', user_id: 'user-1' }) + await removeUserFromListApi({ list_id: 'list-1', email: 'user@example.com' }) expect(fetchMock).toHaveBeenCalledWith( `${API_BASE_URL}/lists/user`, diff --git a/src/stores/lists.ts b/src/stores/lists.ts index 255d6ad..9055252 100644 --- a/src/stores/lists.ts +++ b/src/stores/lists.ts @@ -142,20 +142,20 @@ export const useListsStore = defineStore('lists', () => { void sync() } - async function addUserToList(listId: string, userId: string) { + async function addUserToList(listId: string, email: string) { await enqueue({ type: 'addUserToList', - payload: { list_id: listId, user_id: userId }, + payload: { list_id: listId, email }, localListId: listId, }) await refresh() void sync() } - async function removeUserFromList(listId: string, userId: string) { + async function removeUserFromList(listId: string, email: string) { await enqueue({ type: 'removeUserFromList', - payload: { list_id: listId, user_id: userId }, + payload: { list_id: listId, email }, localListId: listId, }) await refresh() @@ -255,11 +255,11 @@ export const useListsStore = defineStore('lists', () => { break } case 'addUserToList': { - await addUserToListApi(entry.payload as { list_id: string; user_id: string }) + await addUserToListApi(entry.payload as { list_id: string; email: string }) break } case 'removeUserFromList': { - await removeUserFromListApi(entry.payload as { list_id: string; user_id: string }) + await removeUserFromListApi(entry.payload as { list_id: string; email: string }) break } } diff --git a/src/types/list.ts b/src/types/list.ts index 79a156d..0bf7c75 100644 --- a/src/types/list.ts +++ b/src/types/list.ts @@ -36,10 +36,10 @@ export interface SetListItemCompletedPayload { export interface AddUserToListPayload { list_id: string - user_id: string + email: string } export interface RemoveUserFromListPayload { list_id: string - user_id: string + email: string }