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

fix: make pinia API store references readonly

API store consumers shouldn’t be able to modify the internal state of
the store.
parent faf4b9b3
No related branches found
No related tags found
No related merge requests found
import { defineStore } from 'pinia'
import { computed, ref, Ref } from 'vue'
import { computed, readonly, ref, Ref } from 'vue'
type ID = number | string
......@@ -101,7 +101,10 @@ export function createExtendableAPI<T extends APIObject>(
}
return {
base: { items, error },
base: {
error: readonly(error),
items: readonly(items),
},
createRequest,
endpoint,
maybeRaiseResponse,
......
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