diff --git a/src/components/CommunityComponents/CommunityRequestForm.vue b/src/components/CommunityComponents/CommunityRequestForm.vue index 7c5f430106fee65e8a424de790f41ec1df7c4fc5..0ea59b7ccf360f9745e9e87c7b407eeb61df68ed 100644 --- a/src/components/CommunityComponents/CommunityRequestForm.vue +++ b/src/components/CommunityComponents/CommunityRequestForm.vue @@ -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 diff --git a/src/components/UserProfileComponents/UserItems.vue b/src/components/UserProfileComponents/UserItems.vue index 88bd3ce45ce066f67be1739aba37e39c219ca129..25038bd7e4c1af6223f5993f85cd72ef4328b299 100644 --- a/src/components/UserProfileComponents/UserItems.vue +++ b/src/components/UserProfileComponents/UserItems.vue @@ -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); }, diff --git a/src/services/user.service.js b/src/services/user.service.js index e2bf48bd4b19f07b3b5f2de07544d1d05a0fc020..44b6159bdec5a16ca2f6893037ac792fa66f751c 100644 --- a/src/services/user.service.js +++ b/src/services/user.service.js @@ -1,4 +1,3 @@ -// 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() {