Skip to content
Snippets Groups Projects
Commit 2576e909 authored by Håkon Eilertsen Røskaft's avatar Håkon Eilertsen Røskaft
Browse files

Merge branch 'main' of...

Merge branch 'main' of https://gitlab.stud.idi.ntnu.no/idatt2106_2022_02/boco-frontend into fix-userprofile-image
parents ff275f39 040dddc2
No related branches found
No related tags found
1 merge request!131Datepicker fix
Pipeline #181530 failed
......@@ -41,6 +41,14 @@
<div class="flex justify-center mt-10 float-right">
<Button @click="saveClicked" id="saveButton" :text="'Send'"> </Button>
</div>
<notification-modal
@click="routeToHome"
:visible="sendRequestClicked"
:title="'Vellykket'"
:message="'Forespørsel sendt!'"
>
</notification-modal>
</div>
</template>
......@@ -51,12 +59,14 @@ 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 NotificationModal from "@/components/BaseComponents/NotificationModal";
export default {
name: "CommunityRequestForm.vue",
components: {
Button,
NotificationModal,
},
setup() {
return { v$: useVuelidate() };
......@@ -81,10 +91,14 @@ export default {
message: "",
communityId: null,
community: {},
sendRequestClicked: false,
};
},
computed: {},
methods: {
routeToHome() {
this.$router.push("/");
},
//TODO fix so that community id is set (not null)
async saveClicked() {
this.communityID = await this.$router.currentRoute.value.params
......@@ -96,6 +110,8 @@ export default {
{ message: this.message },
{ headers: tokenHeader() }
);
this.sendRequestClicked = true;
},
getCommunityFromAPI: async function () {
this.communityID = await this.$router.currentRoute.value.params
......
......@@ -268,12 +268,10 @@ export default {
}
},
goToDeleteItem(item) {
console.log("Halllllo: " + item);
this.chosenItem = item;
this.readyToDelete = true;
},
async deleteItem() {
console.log("HEI " + this.chosenItem);
await UserService.setListingToDeleted(this.chosenItem);
this.$router.go(0);
},
......
// import { tokenHeader } from "@/utils/token-utils";
import { tokenHeader } from "@/utils/token-utils";
import axios from "axios";
......@@ -29,13 +28,15 @@ class UserService {
async setListingToDeleted(listingId) {
return await axios
.put(API_URL + "listing/" + listingId, {
headers: tokenHeader(),
.delete(API_URL + "listing/" + listingId, {
headers: tokenHeader()
})
.then((res) => {
return res.data;
})
.catch((err) => console.error(err));
.catch((err) => {
console.error(err);
})
}
async getRenterHistory() {
......
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