Skip to content
Snippets Groups Projects
Commit 3dfd8392 authored by Haakon Tideman Kanter's avatar Haakon Tideman Kanter
Browse files

Added member requests for admin in private groups

parent 1c96f57a
No related branches found
No related tags found
1 merge request!89Added member requests for admin in private groups
Pipeline #180056 passed
......@@ -10,6 +10,7 @@
<script>
import UserListItemCard from "@/components/UserProfileComponents/UserListItemCard.vue";
import CommunityService from "@/services/community.service";
import {GetMemberRequestsOfCommunity} from "@/utils/apiutil";
export default {
name: "MemberList",
......@@ -18,6 +19,7 @@ export default {
},
props: {
buttons: Array,
requests: Boolean,
},
data() {
return {
......@@ -30,9 +32,14 @@ export default {
},
async created() {
this.loading = true;
this.members = await CommunityService.getCommunityMembers(
if(this.requests){
this.members = await GetMemberRequestsOfCommunity(
this.$route.params.communityID
);
} else {
this.members = await CommunityService.getCommunityMembers(
this.$route.params.communityID
);}
this.loading = false;
},
};
......
......@@ -237,6 +237,19 @@ export async function GetMembersOfCommunity(communityID) {
});
}
export async function GetMemberRequestsOfCommunity(communityID) {
return axios
.get(API_URL + "communities/" + communityID + "/requests", {
headers: tokenHeader(),
})
.then((response) => {
return response.data;
})
.catch((error) => {
console.error(error);
});
}
export function JoinOpenCommunity(communityId) {
if (tokenHeader().Authorization == "Bearer " + null) {
//console.log("ikke logget på!");
......
......@@ -13,8 +13,8 @@
{{ tab }}
</button>
</div>
<MemberList :buttons="['chat', 'kick']" v-if="currentTab === 0" />
<MemberList :buttons="['accept', 'reject']" v-if="currentTab === 1" />
<MemberList :requests ='false' :buttons="['chat', 'kick']" v-if="currentTab === 0" />
<MemberList :requests ='true' :buttons="['accept', 'reject']" v-if="currentTab === 1" />
<CommunitySettings v-if="currentTab === 2" />
</template>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment