Added an apollo query (THANK U INDIGO). Didnt need to add all of the other stupid stuff like an apollo library or anything.

This commit is contained in:
ajdj100
2023-06-11 01:14:48 -04:00
parent 23af21afe8
commit 51df204869
2 changed files with 32 additions and 6 deletions

View File

@@ -0,0 +1,24 @@
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

View File

@@ -2,12 +2,12 @@
import { ref } from 'vue'
import { Listbox, ListboxButton, ListboxOptions, ListboxOption } from '@headlessui/vue'
import { Icon } from '@iconify/vue'
import QueryApolloGraphQL from '../api/request'
export default {
data() {
return {
parentMessage: 'Parent',
items: [{ message: 'Foo' }, { message: 'Bar' }],
items: [],
dropped: false,
search: '',
@@ -49,9 +49,11 @@ export default {
ListboxOptions,
Icon,
},
mounted() {
QueryApolloGraphQL("getPageViewMemberRankStatusAll", "query Query {getPageViewMemberRankStatusAll {items {member_name,rank,status}}}").then(value => { console.log(value); this.items = value})
}
}
// const unitFilter = ref(unitFilters[1])
</script>
<template>
@@ -129,9 +131,9 @@ export default {
</thead>
<tbody id="tableBody">
<tr v-for="(item, index) in items">
<td>{{ parentMessage }}</td>
<td>{{ index }}</td>
<td>{{ item.message }}</td>
<td>{{ item.member_name }}</td>
<td>{{ item.status }}</td>
<td>{{ item.rank }}</td>
</tr>
</tbody>
</table>