Skip to content

Commit

Permalink
Code Fix
Browse files Browse the repository at this point in the history
Fixed code with the suggestions.
  • Loading branch information
SalleeMatthew authored and dburleson committed Sep 4, 2024
1 parent df73d1b commit 223f660
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/src/routes/object-instance.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
2 changes: 1 addition & 1 deletion spa/src/components/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down
12 changes: 5 additions & 7 deletions spa/src/pages/ObjectProperties.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 223f660

Please sign in to comment.