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:
24
17th Website/src/api/request.js
Normal file
24
17th Website/src/api/request.js
Normal 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
|
||||||
@@ -2,12 +2,12 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { Listbox, ListboxButton, ListboxOptions, ListboxOption } from '@headlessui/vue'
|
import { Listbox, ListboxButton, ListboxOptions, ListboxOption } from '@headlessui/vue'
|
||||||
import { Icon } from '@iconify/vue'
|
import { Icon } from '@iconify/vue'
|
||||||
|
import QueryApolloGraphQL from '../api/request'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
parentMessage: 'Parent',
|
items: [],
|
||||||
items: [{ message: 'Foo' }, { message: 'Bar' }],
|
|
||||||
dropped: false,
|
dropped: false,
|
||||||
search: '',
|
search: '',
|
||||||
|
|
||||||
@@ -49,9 +49,11 @@ export default {
|
|||||||
ListboxOptions,
|
ListboxOptions,
|
||||||
Icon,
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -129,9 +131,9 @@ export default {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody id="tableBody">
|
<tbody id="tableBody">
|
||||||
<tr v-for="(item, index) in items">
|
<tr v-for="(item, index) in items">
|
||||||
<td>{{ parentMessage }}</td>
|
<td>{{ item.member_name }}</td>
|
||||||
<td>{{ index }}</td>
|
<td>{{ item.status }}</td>
|
||||||
<td>{{ item.message }}</td>
|
<td>{{ item.rank }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user