character.js 615 B

12345678910111213141516171819202122
  1. export const characterQueryKeys = {
  2. root: ["characters"],
  3. options: () => [...characterQueryKeys.root, "options"],
  4. byId: (id) => ["character", id]
  5. }
  6. export const characterListQuery = defineQueryOptions({
  7. key: characterQueryKeys.root,
  8. query: () => useEmit("character:list"),
  9. normalize: true
  10. })
  11. export const characterOptionsQuery = defineQueryOptions({
  12. key: characterQueryKeys.options,
  13. query: () => useEmit("character:options")
  14. })
  15. export const characterByIdQuery = defineQueryOptions((id) => ({
  16. key: characterQueryKeys.byId(id),
  17. query: () => useEmit("character:read", id),
  18. normalize: true
  19. }))