Add ordering, limits
This commit is contained in:
parent
a4c48b3cce
commit
0b9cd7ff54
17
src/App.tsx
17
src/App.tsx
@ -44,10 +44,21 @@ function buildRequest(searchTerm: string, conlang: Conlang, direction: SearchDir
|
||||
[Conlang.Elesu]: 'elesu',
|
||||
};
|
||||
|
||||
const offset = 0;
|
||||
const limit = 20;
|
||||
|
||||
const conlangDb = conlang.toString();
|
||||
const field = direction === SearchDirection.ToConlang ? 'eng' : specForConlang[conlang];
|
||||
const query = `${conlangDb}?${field}=like.*${searchTerm}*`;
|
||||
const effectiveUri = `${backendUrl}/${query}`;
|
||||
const conlangSpec = specForConlang[conlang];
|
||||
const field = direction === SearchDirection.ToConlang ? 'eng' : conlangSpec;
|
||||
|
||||
const params = new URLSearchParams([
|
||||
[field, `like.*${searchTerm}*`],
|
||||
['order', conlangSpec],
|
||||
['limit', limit],
|
||||
['offset', offset],
|
||||
]);
|
||||
|
||||
const effectiveUri = `${backendUrl}/${conlangDb}?${params}`;
|
||||
|
||||
fetch(`${effectiveUri}`)
|
||||
.then((resp) => resp.json())
|
||||
|
Loading…
Reference in New Issue
Block a user