Skip to content
Snippets Groups Projects
Commit 3fd87533 authored by Titus Netland's avatar Titus Netland
Browse files

Merge branch 'community-request' into 'main'

Added member requests for admin in private groups

See merge request !89
parents b7556483 3dfd8392
Loading
Checking pipeline status
......@@ -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