fix: adding user to list now only works online, and it never queued

This commit is contained in:
2026-08-21 22:22:36 +02:00
parent ee360c6994
commit 2634bd0db0
3 changed files with 40 additions and 12 deletions
+4 -11
View File
@@ -145,13 +145,10 @@ export const useListsStore = defineStore('lists', () => {
}
async function addUserToList(listId: string, email: string) {
await enqueue({
type: 'addUserToList',
payload: { list_id: listId, email },
localListId: listId,
})
await refresh()
void sync()
if (typeof navigator !== 'undefined' && !navigator.onLine) {
throw new Error('Cannot share list while offline')
}
await addUserToListApi({ list_id: listId, email })
}
async function removeUserFromList(listId: string, email: string) {
@@ -290,10 +287,6 @@ export const useListsStore = defineStore('lists', () => {
await db.listItems.update(entry.localListItemId, { pendingSync: false })
break
}
case 'addUserToList': {
await addUserToListApi(entry.payload as { list_id: string; email: string })
break
}
case 'removeUserFromList': {
await removeUserFromListApi(entry.payload as { list_id: string; email: string })
break