As my personal project I want to make a desktop app with the use of Electron and Vue. I've got that all set up and running flawlessly with already finished gui, but there is one small problem. To get the system info I'm using systeminformation and calling it in the script tag of my General.vue file doesn't work.
General.js
<script>
import { defineComponent } from 'vue'
import systeminformation from 'systeminformation'
export default defineComponent({
name: 'General',
mounted () {
this.getData() // Call the function once started
},
methods: {
getData: function () {
console.log('test 1') // Gets printed out
systeminformation.cpu()
.then(data => console.log(data)) // All of these do nothing
.catch(reason => console.log(reason))
.finally(() => console.log('test 1.5'))
console.log('test 2') // Gets printed out
}
}
})
</script>
This code is supposed to get all the information about the CPU of my device, but nothing is showing up in the console except for the tests. I've tried running it in a simple test project with just basic Node and it works just as it's supposed to be.
My only theory as to why it's not working here is perhaps that it's in .vue and too far away from the backend part of the app? I will be very grateful for any help. If you want to experiment, here's a link to the project for you to clone it.