Skip to content

Commit

Permalink
fix: use update api endpoint to fetch publications and authors for fi…
Browse files Browse the repository at this point in the history
…lter options
  • Loading branch information
stefanprobst committed May 15, 2024
1 parent 0116b98 commit 67b92d7
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions src/lib/sola/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ import {
getSolaPassageTopics,
getSolaPassageTypes,
getSolaPersonById,
getSolaPersons,
getSolaPlaceById,
getSolaPublicationById,
getSolaPublications,
getSolaTextById,
getSolaTextTypes,
getSolaUsers,
Expand Down Expand Up @@ -288,8 +286,6 @@ export function useSolaSelectedEntity() {
export function useSolaFilterOptions() {
const locale = useCurrentLocale()

const { person } = useSolaRelationTypes()

const passageTopics = useQuery(
['getSolaPassageTopics', locale, {}],
() => {
Expand All @@ -304,24 +300,10 @@ export function useSolaFilterOptions() {
},
{ select: mapResultsById },
)
const publications = useQuery(
['getSolaPublications', locale, {}],
() => {
return getSolaPublications({ query: defaultQuery, locale })
},
{ select: mapResultsById },
)
const authorQuery = { publication_relationtype_set__id: person.isAuthorOf }
const authors = useQuery(
['getSolaPersons', locale, authorQuery],
() => {
return getSolaPersons({
query: { ...authorQuery, ...defaultQuery },
locale,
})
},
{ select: mapResultsById },
)

const { data } = useSolaEntities()
const publications = data?.publications ?? {}
const authors = data?.persons ?? {}

return {
authors,
Expand Down

0 comments on commit 67b92d7

Please sign in to comment.