36 lines
1020 B
JavaScript

/*
* 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', options);
let url = `/fr/search.json?name=person_regular&q=${query}`;
return fetch(url)
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
});
};
/*
* 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 };