mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
adapt api endpoint, resolve id parameter passed in api functions
This commit is contained in:
@@ -1,16 +1,12 @@
|
||||
const
|
||||
locale = 'fr',
|
||||
format = 'json'
|
||||
;
|
||||
|
||||
/*
|
||||
* Endpoint chill_person_search, method GET, get a list of persons
|
||||
* Endpoint chill_person_search
|
||||
* method GET, get a list of persons
|
||||
*
|
||||
* @query string - the query to search for
|
||||
*/
|
||||
let searchPersons = ({ query, options }) => {
|
||||
console.log('options 2', options);
|
||||
let url = `/${locale}/search.${format}?name=person_regular&q=${query}`;
|
||||
console.log('options', options);
|
||||
let url = `/fr/search.json?name=person_regular&q=${query}`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
@@ -18,4 +14,22 @@ let searchPersons = ({ query, options }) => {
|
||||
});
|
||||
};
|
||||
|
||||
export { searchPersons };
|
||||
/*
|
||||
* Endpoint v.2 chill_main_search_global
|
||||
* method GET, get a list of persons and thirdparty
|
||||
*
|
||||
* NOTE: this is a temporary WIP endpoint, return inconsistent random results
|
||||
* @query string - the query to search for
|
||||
*/
|
||||
let searchPersons_2 = ({ query, options }) => {
|
||||
console.log('options', options);
|
||||
let url = `/api/1.0/search.json?q=${query}`
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export { searchPersons, searchPersons_2 };
|
||||
|
Reference in New Issue
Block a user