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

Renamed description to message

parents d7aed17d 2b976bc8
No related branches found
No related tags found
1 merge request!87Community request
Pipeline #180005 failed
...@@ -132,7 +132,6 @@ export default { ...@@ -132,7 +132,6 @@ export default {
this.items = await GetListingsInCommunity(this.communityID); this.items = await GetListingsInCommunity(this.communityID);
for (var i = 0; i < this.items.length; i++) { for (var i = 0; i < this.items.length; i++) {
let images = await getItemPictures(this.items[i].listingID); let images = await getItemPictures(this.items[i].listingID);
//console.log(images);
if (images.length > 0) { if (images.length > 0) {
this.items[i].img = images[0].picture; this.items[i].img = images[0].picture;
} }
......
...@@ -10,25 +10,25 @@ ...@@ -10,25 +10,25 @@
</div> </div>
<!-- Description --> <!-- message -->
<div class="mt-6" :class="{ error: v$.description.$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="descriptionLabel" id="messageLabel"
> Melding til administrator av gruppa: </label > Melding til administrator av gruppa: </label
> >
<textarea <textarea
id="description" id="message"
rows="4" rows="4"
v-model="description" v-model="message"
class="block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-500 bg-white border rounded-md dark:bg-gray-800 dark:border-gray-600 dark:placeholder-gray-400 focus:border-primary-light dark:focus:border-primary-light focus:ring-opacity-40 focus:outline-none focus:ring focus:ring-primary-light" class="block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-500 bg-white border rounded-md dark:bg-gray-800 dark:border-gray-600 dark:placeholder-gray-400 focus:border-primary-light dark:focus:border-primary-light focus:ring-opacity-40 focus:outline-none focus:ring focus:ring-primary-light"
required required
></textarea> ></textarea>
<!-- error message for description --> <!-- error message for message -->
<div <div
class="text-error" class="text-error"
v-for="(error, index) of v$.description.$errors" v-for="(error, index) of v$.message.$errors"
:key="index" :key="index"
> >
<div class="text-error text-sm"> <div class="text-error text-sm">
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
validations() { validations() {
return { return {
description: { message: {
required: helpers.withMessage( required: helpers.withMessage(
() => "Meldingen kan ikke være tom", () => "Meldingen kan ikke være tom",
required required
...@@ -79,7 +79,7 @@ export default { ...@@ -79,7 +79,7 @@ export default {
}, },
data() { data() {
return { return {
description: "", message: "",
communityId: null, communityId: null,
community: {}, community: {},
}; };
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
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.description, }, {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
......
...@@ -134,12 +134,19 @@ export default { ...@@ -134,12 +134,19 @@ export default {
return; return;
} }
const newPasswordInfo = { const newPassword = this.user.password;
token: this.token,
newPassword: this.password,
};
const newPasswordResponse = doNewPassword(newPasswordInfo); const newPasswordResponse = await doNewPassword(newPassword);
if (newPasswordResponse != null) {
console.log("New password set");
this.$store.commit("saveToken", newPasswordResponse);
await this.$router.push("/");
} else {
console.log("Couldn't set new password");
}
/*
if (newPasswordResponse.newPasswordSet === true) { if (newPasswordResponse.newPasswordSet === true) {
//console.log("New password set"); //console.log("New password set");
...@@ -149,6 +156,8 @@ export default { ...@@ -149,6 +156,8 @@ export default {
} else { } else {
//console.log("Something went wrong"); //console.log("Something went wrong");
} }
*/
}, },
validate() { validate() {
this.$refs.form.validate(); this.$refs.form.validate();
......
...@@ -84,15 +84,22 @@ export function getAverageRating(userid) { ...@@ -84,15 +84,22 @@ export function getAverageRating(userid) {
console.error(error); console.error(error);
}); });
} }
export function doNewPassword() { export async function doNewPassword(password) {
//m let res = await axios({
//add newPasswordInfo to input method: "put",
const auth = { newPasswordSet: false }; url: API_URL + "user/profile/password",
//return axios headers: tokenHeader(),
//.post(API_URL + "newPassword", newPasswordInfo) data: {
//.then((response) => {auth.newPasswordSet = true;return auth;}) password: password,
//.catch((error) => {//console.log(error);return auth;}); },
return auth; //remove after axios is added })
.then((response) => {
return response;
})
.catch((error) => {
console.log(error);
});
return res.data;
} }
export function postNewItem(itemInfo) { export function postNewItem(itemInfo) {
......
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