implemented API call to populate some fields of profile header

This commit is contained in:
ajdj100
2023-10-12 02:44:53 -04:00
parent 228f4c2a9c
commit ff5f76a917
2 changed files with 46 additions and 8 deletions

View File

@@ -1,12 +1,54 @@
<script>
import QueryApolloGraphQL from '../../api/request';
export default {
name: 'profileHeader',
data() {
return {
count: 0
count: 0,
items: [],
user: '',
}
},
mounted() {
this.user = this.$route.params.name;
QueryApolloGraphQL("getPageViewMemberRankStatusAll", `query GetPageViewMemberRankStatusAll {
getPageViewMemberRankStatusAll(filter: "member_name = ${this.user}") {
items {
member_name
status
rank
}
}
}`).then(value => { this.items = value; });
},
computed: {
headerInfo() {
console.log(this.items)
return this.items[0];
},
memberName() {
try {
return this.items[0].member_name;
} catch (E) {
console.log("too slow")
}
},
memberRank() {
try {
return this.items[0].rank;
} catch (E) {
console.log("too slow")
}
},
memberStatus() {
try {
return this.items[0].status;
} catch (E) {
console.log("too slow")
}
},
}
}
</script>
@@ -17,15 +59,14 @@ export default {
<img id="rangerTab" src="../icons/misc/test.png" class="xl:w-32 w-28" />
</div>
<div id="mainInfo">
<h1>Big Name</h1>
<h2>Rank</h2>
<h2>Unit</h2>
<h1>{{ memberName }}</h1>
<h2>{{ memberRank }}</h2>
<h2>{{ memberStatus }}</h2>
</div>
</div>
</template>
<style>
#mainInfo h1 {
margin: 20px 0 10px 0px;
}

View File

@@ -9,9 +9,6 @@ export default {
RouterLink,
Icon
},
setup(props) {
console.log(props.link);
},
computed: {
currentRouteName() {
return this.$route.name;