integrated new API for fetching members

This commit is contained in:
ajdj100
2024-05-26 10:03:39 -04:00
parent ffbf7ca23f
commit ec61da96d7

View File

@@ -50,23 +50,32 @@ export default {
}, },
filterByRole(item) { //THIS IS NOT IMPLEMENTED YET filterByRole(item) { //THIS IS NOT IMPLEMENTED YET
return true; return true;
} },
}, },
components: { components: {
Icon, Icon,
Dropdown, Dropdown,
}, },
mounted() { mounted() {
// QueryApolloGraphQL("getPageViewMemberRankStatusAll", "query Query {getPageViewMemberRankStatusAll {items {member_name,rank,status}}}").then(value => { this.items = value }) //console.log(value); for debug reasons // QueryApolloGraphQL("getPageViewMemberRankStatusAll", "query Query {getPageViewMemberRankStatusAll {items {member_name,rank,status}}}").then(value => { this.items = value }) //console.log(value); for debug reasons
// this.items = fetch("http://iceberg-gaming.com:1323/api/members"); // this.items = fetch("http://iceberg-gaming.com:1323/api/members");
//make API request here //make API request here
fetch('http://iceberg-gaming.com:1323/api/v1/member').then(res => {
console.log(res);
res.json().then(list => {
this.items = list;
console.log(this.items);
});
});
}, },
computed: { computed: {
filteredTable() { filteredTable() {
var newTable = this.items; var newTable = this.items;
newTable = newTable.filter(this.filterByUnit); // newTable = newTable.filter(this.filterByUnit);
newTable = newTable.filter(this.filterByName); // newTable = newTable.filter(this.filterByName);
return newTable; return newTable;
}, },
} }
@@ -85,12 +94,12 @@ export default {
class="mx-2 max-w-md" /> class="mx-2 max-w-md" />
<div id="dropdownWrapper"> <div id="dropdownWrapper">
<Dropdown :values="statusFilters" :currentIndex="currentStatusFilterIndex" display="name" <Dropdown :values="statusFilters" :currentIndex="currentStatusFilterIndex" display="name"
@changeSelection="(index) => currentStatusFilterIndex = index" class="w-36 mr-2"> @changeSelection="(index) => currentStatusFilterIndex = index" class="w-36 mr-2">
</Dropdown> </Dropdown>
<Dropdown :values="roleFilters" :currentIndex="currentRoleFilter" display="name" <Dropdown :values="roleFilters" :currentIndex="currentRoleFilter" display="name"
@changeSelection="(index) => currentRoleFilter = index" class="w-36"> @changeSelection="(index) => currentRoleFilter = index" class="w-36">
</Dropdown> </Dropdown>
<button @click="resetFilters()" <button @click="resetFilters()"
@@ -104,7 +113,7 @@ export default {
<thead> <thead>
<tr> <tr>
<th>Member</th> <th>Member</th>
<th>Unit</th> <th>Status</th>
<th>Rank</th> <th>Rank</th>
<th>Join Date</th> <th>Join Date</th>
<th>LOA Until</th> <th>LOA Until</th>
@@ -114,9 +123,12 @@ export default {
<tbody id="tableBody"> <tbody id="tableBody">
<tr v-for="(item, index) in filteredTable" <tr v-for="(item, index) in filteredTable"
v-on:click="$router.push({ path: `/profile/${item.member_name}/home` })"> v-on:click="$router.push({ path: `/profile/${item.member_name}/home` })">
<td>{{ item.member_name }}</td> <td>{{ item.name }}</td>
<td>{{ item.status }}</td> <td>{{ item.company }}</td>
<td>{{ item.rank }}</td> <td>{{ item.rank.name }}</td>
<td>{{ item.created_at }}</td>
<td>hello</td>
<td>hello</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>