diff --git a/src/components/RentingComponents/ItemInfo.vue b/src/components/RentingComponents/ItemInfo.vue index 61c4e6099a972322c1e05b475af8421e75cb92b1..44622355354e202541b4db52867ecb0eda490f29 100644 --- a/src/components/RentingComponents/ItemInfo.vue +++ b/src/components/RentingComponents/ItemInfo.vue @@ -44,7 +44,10 @@ <div class="mt-6"> <!-- Add in method for displaying user card. Use item.userID on the method --> (Placeholder) Add usercard here - <UserListItemCard :admin="false" :user="this.item.userID"></UserListItemCard> + <UserListItemCard + :admin="false" + :user="this.item.userID" + ></UserListItemCard> </div> <div> <div class="mt-4 space-y-6"> @@ -112,21 +115,21 @@ export default { async getItemPictures() { let id = this.$router.currentRoute.value.params.id; this.images = await getItemPictures(id); - - if(this.images.length < 1) { - let noImage = { - src: require('@/assets/default-product.png'), - alt: "No image found", - }; - this.pictures.push(noImage); + + if (this.images.length < 1) { + let noImage = { + src: require("@/assets/default-product.png"), + alt: "No image found", + }; + this.pictures.push(noImage); } else { for (let i = 0; i < this.images.length; i++) { - let oneImage = { - src: this.images[i].picture, - //How do i make this accurate to the image? - alt: "An image", - }; - this.pictures.push(oneImage); + let oneImage = { + src: this.images[i].picture, + //How do i make this accurate to the image? + alt: "An image", + }; + this.pictures.push(oneImage); } } //TODO fixs so each image get a correct alt text. diff --git a/src/components/RentingComponents/NewRent.vue b/src/components/RentingComponents/NewRent.vue index 726fae58bacda20533296d1bcd22b3ce7c1ccb04..33240c253bff41d1c6e2d5b82dceccd8dada21ca 100644 --- a/src/components/RentingComponents/NewRent.vue +++ b/src/components/RentingComponents/NewRent.vue @@ -46,11 +46,10 @@ export default { title: this.newRentBox.title, fromTime: this.newRentBox.fromTime, toTime: this.newRentBox.toTime, - fromTimeMilliseconds: new Date(this.newRentBox.fromTime).getMilliseconds, - toTimeMilliseconds: new Date(this.newRentBox.toTime).getMilliseconds, + fromTimeMilliseconds: new Date(this.newRentBox.fromTime).valueOf(), + toTimeMilliseconds: new Date(this.newRentBox.toTime).valueOf(), message: "", price: this.newRentBox.price_per_day, - }; }, props: { @@ -71,13 +70,14 @@ export default { }, sendRent: async function () { const rent = { - // message: this.message, + message: this.message, listingId: this.newRentBox.listingId, renterId: this.newRentBox.renterId, isAccepted: false, toTime: this.toTimeMilliseconds, - fromTime: this.fromTimeMilliseconds, + fromTime: this.fromTimeMilliseconds, }; + await postNewRent(rent); console.log(rent); }, diff --git a/src/router/index.js b/src/router/index.js index f1b5c560024d0a7d33cde1c0cc635bc65883b175..35301d22f75dfd3b28cfdb0d04af189e13b4b2eb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -103,7 +103,7 @@ const routes = [ name: "newRent", component: () => import("../views/RentingViews/NewRentView.vue"), }, - { + { beforeEnter: guardRoute, path: "/test", name: "test",