diff --git a/17th Website/src/api/request.js b/17th Website/src/api/request.js new file mode 100644 index 0000000..a9e80b5 --- /dev/null +++ b/17th Website/src/api/request.js @@ -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 \ No newline at end of file diff --git a/17th Website/src/views/users.vue b/17th Website/src/views/users.vue index e41575f..38029a9 100644 --- a/17th Website/src/views/users.vue +++ b/17th Website/src/views/users.vue @@ -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])