Skip to content

Commit

Permalink
revert fetch w/ native
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhj committed Jan 23, 2024
1 parent 64e8a0b commit a070760
Showing 1 changed file with 17 additions and 22 deletions.
39 changes: 17 additions & 22 deletions frontend/src/utils/getSearchResults.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
// import groq from 'groq';
// import { clientGROQ } from '../../groq/client';
import groq from 'groq';
import { clientGROQ } from '../../groq/client';

// const getSearchResults = async ({ language }) =>
const getSearchResults = async () => {
// const groqQuery = groq`
// {
// "all": *[
// _type in ["Activity", "Article", "Page", "Place", "Region", "Service", "Provider", "ThingsToDoPage", "DayTrip"]
// ] | [0...10] { _id }
// }
// `;
const getSearchResults = async ({ language }) => {
const groqQuery = groq`
{
"all": *[
_type in ["Activity", "Article", "Page", "Place", "Region", "Service", "Provider", "ThingsToDoPage", "DayTrip"]
] | [0...10] { _id }
}
`;

// const results = await clientGROQ.fetch(groqQuery, {
// query: '',
// categoryId: '',
// language,
// fallback: 'en',
// });
const results = await clientGROQ.fetch(groqQuery, {
query: '',
categoryId: '',
language,
fallback: 'en',
});

const results = await fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(response => response.json())
.then(json => console.log(json));

return { results: { all: [results] } };
return { results };
};

export default getSearchResults;

0 comments on commit a070760

Please sign in to comment.