Skip to content

Commit

Permalink
Aded POST requests for manifests NS-61
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenwf committed Jul 2, 2024
1 parent 690441b commit a8d756a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
18 changes: 10 additions & 8 deletions services/madoc-ts/src/gateway/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1210,19 +1210,21 @@ export class ApiClient {

async autocompleteManifests(q: string, project_id?: string, blacklist_ids?: number[], page = 1) {
return this.request<Array<{ id: number; label: string }>>(
`/api/madoc/iiif/autocomplete/manifests?${stringify(
{ q, project_id, blacklist_ids, page },
{ arrayFormat: 'comma' }
)}`
`/api/madoc/iiif/autocomplete/manifests?${stringify({ q, project_id, page }, { arrayFormat: 'comma' })}`,
{
method: 'POST',
body: { blacklist_ids },
}
);
}

async autocompleteCollections(q: string, project_id?: string, blacklist_ids?: number[], page = 1) {
return this.request<Array<{ id: number; label: string }>>(
`/api/madoc/iiif/autocomplete/collections?${stringify(
{ q, project_id, blacklist_ids, page },
{ arrayFormat: 'comma' }
)}`
`/api/madoc/iiif/autocomplete/collections?${stringify({ q, project_id, page }, { arrayFormat: 'comma' })}`,
{
method: 'POST',
body: { blacklist_ids },
}
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ export const getManifestAutocomplete: RouteMiddleware<{}, { blacklist_ids?: numb
.map((blacklistId: string) => Number(blacklistId))
.filter((blacklistId: number) => !Number.isNaN(blacklistId));

if (context.requestBody) {
const postBlacklistIds = context.requestBody.blacklist_ids;
if (postBlacklistIds && Array.isArray(postBlacklistIds)) {
blackListIds.push(...postBlacklistIds);
}
}

if (!q) {
context.response.body = [];
return;
Expand Down

0 comments on commit a8d756a

Please sign in to comment.