24 lines
547 B
JavaScript
24 lines
547 B
JavaScript
async function QueryApolloGraphQL (setName, query) {
|
|
return await fetch(
|
|
'https://unit-tracker-api.iceberg-gaming.com/',
|
|
{
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
cache: 'no-cache',
|
|
body: JSON.stringify({
|
|
"query": query
|
|
})
|
|
})
|
|
.then(response => response.json())
|
|
.then(response => {
|
|
return response.data[setName].items;
|
|
})
|
|
.catch((error) => {
|
|
return console.error('Error:', error);
|
|
}
|
|
);
|
|
}
|
|
|
|
export default QueryApolloGraphQL |