Prechádzať zdrojové kódy

revert characterByIdQuery to character:read

Jason Gorst 3 týždňov pred
rodič
commit
de9f6a8221
1 zmenil súbory, kde vykonal 2 pridanie a 17 odobranie
  1. 2 17
      app/queries/character.js

+ 2 - 17
app/queries/character.js

@@ -1,7 +1,7 @@
 // noinspection JSCheckFunctionSignatures
 
 export const characterQueryKeys = {
-  root: ["characterList"],
+  root: ["characters"],
   options: () => [...characterQueryKeys.root, "options"],
   byId: (id) => ["character", id]
 }
@@ -18,20 +18,5 @@ export const characterOptionsQuery = defineQueryOptions({
 
 export const characterByIdQuery = defineQueryOptions((id) => ({
   key: characterQueryKeys.byId(id),
-
-  query: async () => {
-    const { data: characterList } = await usePrefetchCharacterList()
-
-    if (_isNil(characterList) || _isEmpty(characterList)) {
-      throw new QueryError("error fetching characterList", { key: characterQueryKeys.byId(id) })
-    }
-
-    const character = _find(characterList, { id })
-
-    if (_isNil(character)) {
-      throw new QueryError(`character with id ${id} not found`, { key: characterQueryKeys.byId(id) })
-    }
-
-    return character
-  }
+  query: () => useEmit("character:read", id)
 }))