fix: use field "email" instead of "user_id" in /lists/user

This commit is contained in:
2026-08-21 20:56:27 +02:00
parent 37bfd315e1
commit d00361c4ac
3 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -157,7 +157,7 @@ describe('lists API', () => {
} as unknown as Response) } as unknown as Response)
global.fetch = fetchMock 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( expect(fetchMock).toHaveBeenCalledWith(
`${API_BASE_URL}/lists/user`, `${API_BASE_URL}/lists/user`,
@@ -172,7 +172,7 @@ describe('lists API', () => {
} as unknown as Response) } as unknown as Response)
global.fetch = fetchMock 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( expect(fetchMock).toHaveBeenCalledWith(
`${API_BASE_URL}/lists/user`, `${API_BASE_URL}/lists/user`,
+6 -6
View File
@@ -142,20 +142,20 @@ export const useListsStore = defineStore('lists', () => {
void sync() void sync()
} }
async function addUserToList(listId: string, userId: string) { async function addUserToList(listId: string, email: string) {
await enqueue({ await enqueue({
type: 'addUserToList', type: 'addUserToList',
payload: { list_id: listId, user_id: userId }, payload: { list_id: listId, email },
localListId: listId, localListId: listId,
}) })
await refresh() await refresh()
void sync() void sync()
} }
async function removeUserFromList(listId: string, userId: string) { async function removeUserFromList(listId: string, email: string) {
await enqueue({ await enqueue({
type: 'removeUserFromList', type: 'removeUserFromList',
payload: { list_id: listId, user_id: userId }, payload: { list_id: listId, email },
localListId: listId, localListId: listId,
}) })
await refresh() await refresh()
@@ -255,11 +255,11 @@ export const useListsStore = defineStore('lists', () => {
break break
} }
case 'addUserToList': { case 'addUserToList': {
await addUserToListApi(entry.payload as { list_id: string; user_id: string }) await addUserToListApi(entry.payload as { list_id: string; email: string })
break break
} }
case 'removeUserFromList': { case 'removeUserFromList': {
await removeUserFromListApi(entry.payload as { list_id: string; user_id: string }) await removeUserFromListApi(entry.payload as { list_id: string; email: string })
break break
} }
} }
+2 -2
View File
@@ -36,10 +36,10 @@ export interface SetListItemCompletedPayload {
export interface AddUserToListPayload { export interface AddUserToListPayload {
list_id: string list_id: string
user_id: string email: string
} }
export interface RemoveUserFromListPayload { export interface RemoveUserFromListPayload {
list_id: string list_id: string
user_id: string email: string
} }