Skip to content
Snippets Groups Projects
Commit 986e39dc authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

feat: allow store list operations without commiting to the store

parent e950b5a4
No related branches found
No related tags found
No related merge requests found
...@@ -164,6 +164,7 @@ export function createExtendableAPI<T extends APIObject>( ...@@ -164,6 +164,7 @@ export function createExtendableAPI<T extends APIObject>(
} }
type ListOperationOptions = BaseRequestOptions & { type ListOperationOptions = BaseRequestOptions & {
noStoreCommit?: boolean | undefined
query?: URLSearchParams | undefined query?: URLSearchParams | undefined
} }
...@@ -174,8 +175,10 @@ export function APIListUnpaginated<T extends APIObject>(api: ExtendableAPI<T>) { ...@@ -174,8 +175,10 @@ export function APIListUnpaginated<T extends APIObject>(api: ExtendableAPI<T>) {
const res = await fetch(api.createRequest(api.endpoint(query), init)) const res = await fetch(api.createRequest(api.endpoint(query), init))
await api.maybeRaiseResponse(res) await api.maybeRaiseResponse(res)
const items: T[] = await res.json() const items: T[] = await res.json()
for (const item of items) { if (options.noStoreCommit !== true) {
api.itemMap.value.set(item.id, item) for (const item of items) {
api.itemMap.value.set(item.id, item)
}
} }
return items return items
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment