Skip to content

Commit

Permalink
fix: remove prefixed from detail IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
sennierer committed Dec 3, 2024
1 parent a6a9389 commit bd97c6c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
11 changes: 2 additions & 9 deletions app/composables/use-ts-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,8 @@ export async function getFacets<T extends AnyEntity>(
});
}

export async function getDetails<T extends AnyDetail>(
model: string,
id: string,
idName?: string,
): Promise<T> {
return useDefaultClient()
.collections<T>(`viecpro_detail_${model}`)
.documents(`detail_${idName ?? model}_${id}`)
.retrieve();
export async function getDetails<T extends AnyDetail>(model: string, id: string): Promise<T> {
return useDefaultClient().collections<T>(`viecpro_detail_${model}`).documents(id).retrieve();
}

export async function getSchema(collection: string): Promise<CollectionSchema> {
Expand Down
2 changes: 1 addition & 1 deletion app/pages/detail/courts/[id]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const data = ref({
details: useQuery({
queryKey: ["detail", collection, id],
queryFn: () => {
return getDetails<CourtDetail>("court", id, "institution");
return getDetails<CourtDetail>("court", id);
},
}),
refs: useQuery({
Expand Down
2 changes: 1 addition & 1 deletion app/pages/detail/institutions/[id]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const altData = ref({
details: useQuery({
queryKey: ["detail", "viecpro_courts", id],
queryFn: () => {
return getDetails<CourtDetail>("court", id, "institution");
return getDetails<CourtDetail>("court", id);
},
enabled: fetchCourts,
}),
Expand Down

0 comments on commit bd97c6c

Please sign in to comment.