diff --git a/src/components/CommunityComponents/CommunityListItem.vue b/src/components/CommunityComponents/CommunityListItem.vue index f260d3b475014d6c247a12b73543f8364a9801ba..1dc94f4e3421de11b7367b51ad8c12eae11a242b 100644 --- a/src/components/CommunityComponents/CommunityListItem.vue +++ b/src/components/CommunityComponents/CommunityListItem.vue @@ -8,20 +8,19 @@ <div class="flex justify-center p-2"> <!-- If a user is not a member in the community, this button will show --> <ColoredButton - v-if="!member && community.visibility!==0" + v-if="!member && community.visibility !== 0" :text="'Bli med'" @click="goToJoin(community.communityId)" class="m-2" /> - <ColoredButton - v-if="!member && community.visibility===0" + <ColoredButton + v-if="!member && community.visibility === 0" :text="'Spør om å bli med'" @click="goToRequest(community.communityId)" class="m-2" - /> + /> - <!-- If a user is member this button will show --> <ColoredButton v-if="member" @@ -104,8 +103,8 @@ export default { this.$router.push("/community/" + id); } }, - goToRequest(id){ - this.$router.push("/community/" + id + "/private/join") + goToRequest(id) { + this.$router.push("/community/" + id + "/private/join"); }, toggleDialog() { this.dialogOpen = !this.dialogOpen; diff --git a/src/components/CommunityComponents/CommunityRequestForm.vue b/src/components/CommunityComponents/CommunityRequestForm.vue index d0b58ae3aab0a895f1444060ba7b0d36653ce313..51a2e418c064f125ea349ae9141ba96f4c12b025 100644 --- a/src/components/CommunityComponents/CommunityRequestForm.vue +++ b/src/components/CommunityComponents/CommunityRequestForm.vue @@ -6,17 +6,17 @@ <div class="text-xl md:text-2xl font-medium text-center text-gray-600 dark:text-gray-200 mt-4 mb-10" > - Bli med i: {{community.name}} + Bli med i: {{ community.name }} </div> - <!-- message --> <div class="mt-6" :class="{ error: v$.message.$errors.length }"> <label class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-400" id="messageLabel" - > Melding til administrator av gruppa: </label > + Melding til administrator av gruppa: + </label> <textarea id="message" rows="4" @@ -49,8 +49,8 @@ import axios from "axios"; import useVuelidate from "@vuelidate/core"; import { required, helpers, maxLength } from "@vuelidate/validators"; import Button from "@/components/BaseComponents/ColoredButton"; -import {tokenHeader} from "@/utils/token-utils"; -import {GetCommunity} from "@/utils/apiutil"; +import { tokenHeader } from "@/utils/token-utils"; +import { GetCommunity } from "@/utils/apiutil"; export default { name: "CommunityRequestForm.vue", @@ -64,45 +64,48 @@ export default { validations() { return { - message: { - required: helpers.withMessage( - () => "Meldingen kan ikke være tom", - required - ), - max: helpers.withMessage( - () => `Meldingen kan inneholde max 200 tegn`, - maxLength(200) - ), - }, - + message: { + required: helpers.withMessage( + () => "Meldingen kan ikke være tom", + required + ), + max: helpers.withMessage( + () => `Meldingen kan inneholde max 200 tegn`, + maxLength(200) + ), + }, }; }, data() { return { - message: "", - communityId: null, - community: {}, + message: "", + communityId: null, + community: {}, }; }, - computed: { - }, + computed: {}, methods: { //TODO fix so that community id is set (not null) async saveClicked() { - this.communityID = await this.$router.currentRoute.value.params + this.communityID = await this.$router.currentRoute.value.params .communityID; - await axios.post(process.env.VUE_APP_BASEURL+ `communities/${this.communityID}/private/join`, {message: this.message, }, {headers: tokenHeader()} ); + await axios.post( + process.env.VUE_APP_BASEURL + + `communities/${this.communityID}/private/join`, + { message: this.message }, + { headers: tokenHeader() } + ); }, - getCommunityFromAPI: async function () { + getCommunityFromAPI: async function () { this.communityID = await this.$router.currentRoute.value.params .communityID; - console.log("Dette er community id =" + this.communityID) + console.log("Dette er community id =" + this.communityID); this.community = await GetCommunity(this.communityID); - console.log(this.community) - } + console.log(this.community); + }, }, - async created() { + async created() { await this.getCommunityFromAPI(); //To get the id of the community before mounting the view }, }; diff --git a/src/components/CommunityComponents/MemberList.vue b/src/components/CommunityComponents/MemberList.vue index bf2d75aeb736678ba47b4ba1106107e7aa44e899..336481461284383d1e4c90bcb0408b28b1a8c468 100644 --- a/src/components/CommunityComponents/MemberList.vue +++ b/src/components/CommunityComponents/MemberList.vue @@ -10,7 +10,7 @@ <script> import UserListItemCard from "@/components/UserProfileComponents/UserListItemCard.vue"; import CommunityService from "@/services/community.service"; -import {GetMemberRequestsOfCommunity} from "@/utils/apiutil"; +import { GetMemberRequestsOfCommunity } from "@/utils/apiutil"; export default { name: "MemberList", @@ -32,14 +32,15 @@ export default { }, async created() { this.loading = true; - if(this.requests){ - this.members = await GetMemberRequestsOfCommunity( - this.$route.params.communityID - ); + if (this.requests) { + this.members = await GetMemberRequestsOfCommunity( + this.$route.params.communityID + ); } else { - this.members = await CommunityService.getCommunityMembers( - this.$route.params.communityID - );} + this.members = await CommunityService.getCommunityMembers( + this.$route.params.communityID + ); + } this.loading = false; }, }; diff --git a/src/components/FormComponents/NewPasswordForm.vue b/src/components/FormComponents/NewPasswordForm.vue index 697b4cf1c6a32d35626151df07bf57e6bae5bbf8..863a17d2ce1918c0e2bf86f124a150cc03446eea 100644 --- a/src/components/FormComponents/NewPasswordForm.vue +++ b/src/components/FormComponents/NewPasswordForm.vue @@ -100,7 +100,7 @@ </div> <div class="flex items-center justify-center text-center bg-gray-50"> <label - class="mx-2 text-sm font-bold text-red-500 dark:text-primary-light hover:underline" + class="mx-2 text-sm font-bold text-error-medium dark:text-primary-light hover:underline" >{{ message }}</label > </div> diff --git a/src/components/UserProfileComponents/UserProfile.vue b/src/components/UserProfileComponents/UserProfile.vue index 9235ab472cdd07769260c182f5acc0fddd9632a8..5735b15c4a562732106c2222d73abbf4d87779ef 100644 --- a/src/components/UserProfileComponents/UserProfile.vue +++ b/src/components/UserProfileComponents/UserProfile.vue @@ -70,7 +70,7 @@ <li> <router-link to="" - class="block py-2 px-4 text-sm text-error hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white" + class="block py-2 px-4 text-sm text-error-dark hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white" >Slett bruker</router-link > </li> diff --git a/src/utils/apiutil.js b/src/utils/apiutil.js index afdac71cf7919ead04cf6523a01d1c8d54e1a2ec..53e9d04c235b0c05b302e14b03d089f5990ee4f6 100644 --- a/src/utils/apiutil.js +++ b/src/utils/apiutil.js @@ -226,8 +226,6 @@ export async function GetListingsInCommunity(communityID) { }); } - - export async function GetMembersOfCommunity(communityID) { return axios .get(API_URL + "community/" + communityID + "/members", { diff --git a/src/views/CommunityViews/AdminView.vue b/src/views/CommunityViews/AdminView.vue index 4c7fa00a00973f9b2818ad15dc6a7e7256dad19b..7912ea2b5fb332dfe0274f0531312b9c6f71ae84 100644 --- a/src/views/CommunityViews/AdminView.vue +++ b/src/views/CommunityViews/AdminView.vue @@ -13,8 +13,16 @@ {{ tab }} </button> </div> - <MemberList :requests ='false' :buttons="['chat', 'kick']" v-if="currentTab === 0" /> - <MemberList :requests ='true' :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>