Skip to content
Snippets Groups Projects
Commit 95a9cc69 authored by Erik Borgeteien Hansen's avatar Erik Borgeteien Hansen
Browse files

lint

parent 826660dd
No related branches found
No related tags found
1 merge request!88Community admin
Pipeline #180041 passed
...@@ -8,20 +8,19 @@ ...@@ -8,20 +8,19 @@
<div class="flex justify-center p-2"> <div class="flex justify-center p-2">
<!-- If a user is not a member in the community, this button will show --> <!-- If a user is not a member in the community, this button will show -->
<ColoredButton <ColoredButton
v-if="!member && community.visibility!==0" v-if="!member && community.visibility !== 0"
:text="'Bli med'" :text="'Bli med'"
@click="goToJoin(community.communityId)" @click="goToJoin(community.communityId)"
class="m-2" class="m-2"
/> />
<ColoredButton <ColoredButton
v-if="!member && community.visibility===0" v-if="!member && community.visibility === 0"
:text="'Spør om å bli med'" :text="'Spør om å bli med'"
@click="goToRequest(community.communityId)" @click="goToRequest(community.communityId)"
class="m-2" class="m-2"
/> />
<!-- If a user is member this button will show --> <!-- If a user is member this button will show -->
<ColoredButton <ColoredButton
v-if="member" v-if="member"
...@@ -104,8 +103,8 @@ export default { ...@@ -104,8 +103,8 @@ export default {
this.$router.push("/community/" + id); this.$router.push("/community/" + id);
} }
}, },
goToRequest(id){ goToRequest(id) {
this.$router.push("/community/" + id + "/private/join") this.$router.push("/community/" + id + "/private/join");
}, },
toggleDialog() { toggleDialog() {
this.dialogOpen = !this.dialogOpen; this.dialogOpen = !this.dialogOpen;
......
...@@ -6,17 +6,17 @@ ...@@ -6,17 +6,17 @@
<div <div
class="text-xl md:text-2xl font-medium text-center text-gray-600 dark:text-gray-200 mt-4 mb-10" 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> </div>
<!-- message --> <!-- message -->
<div class="mt-6" :class="{ error: v$.message.$errors.length }"> <div class="mt-6" :class="{ error: v$.message.$errors.length }">
<label <label
class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-400" class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-400"
id="messageLabel" id="messageLabel"
> Melding til administrator av gruppa: </label
> >
Melding til administrator av gruppa:
</label>
<textarea <textarea
id="message" id="message"
rows="4" rows="4"
...@@ -49,8 +49,8 @@ import axios from "axios"; ...@@ -49,8 +49,8 @@ import axios from "axios";
import useVuelidate from "@vuelidate/core"; import useVuelidate from "@vuelidate/core";
import { required, helpers, maxLength } from "@vuelidate/validators"; import { required, helpers, maxLength } from "@vuelidate/validators";
import Button from "@/components/BaseComponents/ColoredButton"; import Button from "@/components/BaseComponents/ColoredButton";
import {tokenHeader} from "@/utils/token-utils"; import { tokenHeader } from "@/utils/token-utils";
import {GetCommunity} from "@/utils/apiutil"; import { GetCommunity } from "@/utils/apiutil";
export default { export default {
name: "CommunityRequestForm.vue", name: "CommunityRequestForm.vue",
...@@ -64,45 +64,48 @@ export default { ...@@ -64,45 +64,48 @@ export default {
validations() { validations() {
return { return {
message: { message: {
required: helpers.withMessage( required: helpers.withMessage(
() => "Meldingen kan ikke være tom", () => "Meldingen kan ikke være tom",
required required
), ),
max: helpers.withMessage( max: helpers.withMessage(
() => `Meldingen kan inneholde max 200 tegn`, () => `Meldingen kan inneholde max 200 tegn`,
maxLength(200) maxLength(200)
), ),
}, },
}; };
}, },
data() { data() {
return { return {
message: "", message: "",
communityId: null, communityId: null,
community: {}, community: {},
}; };
}, },
computed: { computed: {},
},
methods: { methods: {
//TODO fix so that community id is set (not null) //TODO fix so that community id is set (not null)
async saveClicked() { async saveClicked() {
this.communityID = await this.$router.currentRoute.value.params this.communityID = await this.$router.currentRoute.value.params
.communityID; .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 this.communityID = await this.$router.currentRoute.value.params
.communityID; .communityID;
console.log("Dette er community id =" + this.communityID) console.log("Dette er community id =" + this.communityID);
this.community = await GetCommunity(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 await this.getCommunityFromAPI(); //To get the id of the community before mounting the view
}, },
}; };
......
...@@ -222,8 +222,6 @@ export async function GetListingsInCommunity(communityID) { ...@@ -222,8 +222,6 @@ export async function GetListingsInCommunity(communityID) {
}); });
} }
export async function GetMembersOfCommunity(communityID) { export async function GetMembersOfCommunity(communityID) {
return axios return axios
.get(API_URL + "community/" + communityID + "/members", { .get(API_URL + "community/" + communityID + "/members", {
......
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