From 223f660869c27e7b3a031b86ebb0d5c3af0baacc Mon Sep 17 00:00:00 2001 From: SalleeMatthew <132789789+SalleeMatthew@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:53:51 -0500 Subject: [PATCH] Code Fix Fixed code with the suggestions. --- api/src/routes/object-instance.routes.ts | 2 +- spa/src/components/Chat.vue | 2 +- spa/src/pages/ObjectProperties.vue | 12 +++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/api/src/routes/object-instance.routes.ts b/api/src/routes/object-instance.routes.ts index c5fa7af3..e7f93325 100644 --- a/api/src/routes/object-instance.routes.ts +++ b/api/src/routes/object-instance.routes.ts @@ -12,7 +12,7 @@ objectInstanceRoutes.post('/:id/drop', (request, response) => objectInstanceRoutes.post('/:id/pickup', (request, response) => objectInstanceController.pickUpObjectInstance(request, response), ); -objectInstanceRoutes.post('/:id/properties', (request, response) => +objectInstanceRoutes.get('/:id/properties', (request, response) => objectInstanceController.openObjectProperties(request, response), ); objectInstanceRoutes.post('/update/', (request, response) => diff --git a/spa/src/components/Chat.vue b/spa/src/components/Chat.vue index faaaded2..22cd2912 100644 --- a/spa/src/components/Chat.vue +++ b/spa/src/components/Chat.vue @@ -768,7 +768,7 @@ export default Vue.extend({ this.backpackObjects = this.backpackObjects.filter(obj => { return obj.id !== parseInt(object.obj_id); }); - const updatedObject = await this.$http.post(`/object_instance/${ object.obj_id }/properties/`); + const updatedObject = await this.$http.get(`/object_instance/${ object.obj_id }/properties/`); if(this.activePanel === 'backpack' && [object.member_username, object.buyer_username].includes(this.$store.data.user.username)){ this.backpackObjects.push(updatedObject.data.objectInstance[0]); } diff --git a/spa/src/pages/ObjectProperties.vue b/spa/src/pages/ObjectProperties.vue index c044ea44..aa673448 100644 --- a/spa/src/pages/ObjectProperties.vue +++ b/spa/src/pages/ObjectProperties.vue @@ -147,7 +147,7 @@ methods: { this.instances = object.instances; }) } else { - return await this.$http.post(`/object_instance/${ this.objectId }/properties/`) + return await this.$http.get(`/object_instance/${ this.objectId }/properties/`) .then((response) => { let object = response.data.objectInstance[0]; this.imgFile = `/assets/object/${object.directory}/${object.image}`; @@ -270,12 +270,10 @@ methods: { } else { if(this.walletBalance >= this.price) { try{ - if(confirm('Are you sure you want to buy this item?')){ - await this.$http.post(`/mall/buy/`, { - id: this.objectId}); - this.success = 'Object purchased!'; - await this.objectProperties(); - } + await this.$http.post(`/mall/buy/`, { + id: this.objectId}); + this.success = 'Object purchased!'; + await this.objectProperties(); } catch(error) { console.log(error); }