Skip to content

Commit

Permalink
Update Checker
Browse files Browse the repository at this point in the history
Refactored how the object data is retrieved.
  • Loading branch information
SalleeMatthew committed Jan 8, 2025
1 parent 69ccd20 commit 3ee48cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api/src/routes/object.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const objectRoutes = Router();
objectRoutes.post('/add', (request, response) => objectController.add(request, response));
objectRoutes.post('/increase_quantity', (request, response) =>
objectController.increaseQuantity(request, response));
objectRoutes.get('/getObject/:id', (request, response) =>
objectRoutes.get('/get_object/:id', (request, response) =>
objectController.getObject(request, response));

export { objectRoutes };
24 changes: 15 additions & 9 deletions spa/src/pages/mall/checker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export default Vue.extend({
name: "MallChecker",
data() {
return {
directory: "",
file: "",
}
},
methods: {
Expand All @@ -39,15 +40,20 @@ export default Vue.extend({
browser.currentScene.addRootNode(inline);
},
async loadObject(){
await this.$http.get(`/object/getObject/${ this.$route.params.object_id }`)
.then((response) =>{
let objectPath = `/assets/object/${response.data.object.directory}/${response.data.object.filename}`;
const browser = X3D.getBrowser();
const inline = browser.currentScene.createNode("Inline");
inline.url = new X3D.MFString(objectPath);
browser.currentScene.addRootNode(inline);
})
let objectPath = `/assets/object/${this.directory}/${this.file}`;
const browser = X3D.getBrowser();
const inline = browser.currentScene.createNode("Inline");
inline.url = new X3D.MFString(objectPath);
browser.currentScene.addRootNode(inline);
},
async getObjectDetails(){
const object = await this.$http.get(`/object/get_object/${ this.$route.params.object_id }`);
this.directory = object.data.object.directory;
this.file = object.data.object.filename;
},
},
created(){
this.getObjectDetails();
},
mounted() {
setTimeout(this.loadObjectPreview, 1000);
Expand Down

0 comments on commit 3ee48cd

Please sign in to comment.